ag-gridag-grid-react

Ag Grid | Unselect Filtered Out Rows


So, apparently when you change the filtering on an AgGrid, the default behavior is to keep all of the rows selected - including those that are no longer in the Grid after applying the new filter. This makes for a somewhat confusing user experience, so I want to unselect any rows that have been filtered out. Is there a property on the nodes or the like that I can use to determine if it has been filtered out?

PS. I'm using the Server-Side Row Model


Solution

  • Upon further reflection, I realize that most likely the only way to do what I want would be to execute an additional query(ies) to determine which selections are still valid post-filtering. And since everyone's implementation of the Server-Side Row Model stuff is going to vary, there isn't a good general answer. Nor do I feel like the amount of effort is worth the originally requested behavior - so for the time being I'm just going to deselect everything whenever the filters change.

    const onFilterChanged = useCallback((params:FilterChangedEvent) => {
      params.api.deselectAll();
    }, []);