doonfrs / pluto_grid_plus

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
18 stars 20 forks source link

[Help] - How to force a refresh of the content #8

Closed boeledi closed 6 months ago

boeledi commented 6 months ago

Hi,

First of all, many thanks for maintaining this package.

I have been looking everywhere for a solution to force a refresh of the content of the grid but could not find any "official one".

Case study:

Via an external form, I am creating/editing an item that I save at the server side. Because the grid is a view that combines several entities, I cannot directly add a row, or even update an existing one.

This explains why I would really like to force a refresh (aka a fetch).

The only solution I could find was to update the PlutoLazyPaginationState and make it external, so that I can use a GlobalKey and invoke the key.currentState?.setPage(1); But this is not ideal.

Many thanks

RADeveloping commented 6 months ago

Try using the setFilter method on the PlutoGridStateManager.

stateManager.setFilter((final element) => true);

doonfrs commented 6 months ago

if key.currentState?.setPage(1); works why do you think it is not ideal?