Mewriick / Blazor.FlexGrid

GridView component for Blazor
MIT License
199 stars 35 forks source link

Actions in grid after navigating back to page #111

Closed MAndrade1980 closed 4 years ago

MAndrade1980 commented 4 years ago

Hi, we're running into an issue we are hoping you can shed some light on. We have a grid bound with some action links opening a modal to edit information that is bound to the grid, when the modal saves and closes, it uses a callback for the parent component to rebind the grid with the updated information, which works. We recreate the CollectionTableDataAdapter object with the updated list. What we've noticed is if we navigate to another page through navigation (we're talking webassembly, not server) then navigate back, the grid still does what it should, except that when a modal is opened and saved, it does not refresh the grid, when it is using the same code, but behaving differently after navigating out and back in.

Mewriick commented 4 years ago

Hello @MAndrade1980

can you please show me how you have composed the page with the grid, and methods which manipulate with CollectionTableDataAdapter?

MAndrade1980 commented 4 years ago

Please see an updated version of your demo project attached. What I've done in in the grid razor component, I modified the weather forecast controller to return a random amount of records to show the rebinding working. I also added a drop-down with a single action link called Test in each grid row. When clicked it writes a line to the console and recreates the adapter with a new pull of data from the service. This works if you go right to the grid page (https://localhost:44332/grid), click on the test action link and it will show a different amount of records. The issue is if you navigate out to any other page in the left nav, then navigate back to the grid page, and click the action item, it does not rebind (does hit the function, does write to the console log, just doesn't rebind the grid), things seem to be missing when coming back. Please do let me know if there is anything we are doing wrong (which could always be the case!) or anything else I can provide to assist. Many thanks!

demo-rebind issue.zip

Mewriick commented 4 years ago

@MAndrade1980

Hello thanks for the demo, I probably found the issue. The problem here is that the fragment (with action button) is stored in collection. This collection is in imutable helper object which Grid uses for rendering. In this concrete situation the problem is that dataAdpater is setted in method which is still same for caching reasons. I need to consider how to handle this issue and I hope that in early of next week the new version will be released.

Mewriick commented 4 years ago

Hello @MAndrade1980 ,

new version is released, this bug should be fixed.

Please let me know if it is working for you correctly.

MAndrade1980 commented 4 years ago

Looks great! Many thanks for the quick response!