Coder Social home page Coder Social logo

Comments (7)

kushalmehrotra713 avatar kushalmehrotra713 commented on May 18, 2024

Hi, Keeping in mind issue56 I would like to have an access to Grid state to use it in other component and which will re-render it when I save data in grid. How can I achieve this? Regards

Hi @Krugerro
If I understand correctly, you want to have access to Grid State(items in the Editable Grid) whenever you update something on the Grid.
Also, I am assuming by 'Save', you are referring to the action of updating something on the grid(without clicking the 'Submit' button).

Are these assumptions correct?

from fluentuieditabledetailslist.

Krugerro avatar Krugerro commented on May 18, 2024

Hi @kushalmehrotra713
You understood me well and your assumptions are correct.

from fluentuieditabledetailslist.

kushalmehrotra713 avatar kushalmehrotra713 commented on May 18, 2024

Hi @Krugerro
Please find the below PR that addresses this issue.
#73

Look for onGridUpdate function in GridConsumer.tsx to see how you consume the data from the callback. Dont forget to add onGridUpdate property when calling the Grid.

from fluentuieditabledetailslist.

Krugerro avatar Krugerro commented on May 18, 2024

Works like a charm after single row update and row add 👍. Fails when item is deleted: onGridUpdate is fired but in callback data is still same length (this attribute I tested) and other component does not re-render and data change is not reflected. Please check on this. Thanks.

from fluentuieditabledetailslist.

kushalmehrotra713 avatar kushalmehrotra713 commented on May 18, 2024

Works like a charm after single row update and row add 👍. Fails when item is deleted: onGridUpdate is fired but in callback data is still same length (this attribute I tested) and other component does not re-render and data change is not reflected. Please check on this. Thanks.

Hi @Krugerro
That is by design. You may want to filter the returned items by _grid_row_operation_ == Operation.Delete in order to get the deleted rows.

Reason:-
When you delete an item in the grid, the Grid only does a 'soft delete' i.e. it just marks the _grid_row_operation_ attribute for that row to 'Operation.Delete'. It does not physically delete the row from the data structure. Because, as a user, when you delete the row from the grid, you may want to reconcile that same in the backend(if the data is powered from a backend). For that, you would need to send the identifier of the deleted rows to the backend. Hence, the returned rows contain the deleted rows as well, marked with 'soft delete'.

Now coming to your issue. As I understand, you may be re-rendering the other component based on the length of the current grid data. Instead of that, you can filter the grid data based on different Operations(Update, Add, or Delete) and use those to re-render the other component.

Hope this helps.

from fluentuieditabledetailslist.

Krugerro avatar Krugerro commented on May 18, 2024

That makes complete sense and I will use it while updating data in backend - thought I would have to "calculate" changes by my own now I see everything is included.
Thank you @kushalmehrotra713 very much for updates and explanation.

from fluentuieditabledetailslist.

kushalmehrotra713 avatar kushalmehrotra713 commented on May 18, 2024

Thanks @Krugerro
Glad that it helped. 💯
Closing the issue.

from fluentuieditabledetailslist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.