'Is there a way to get the selected values from text and number filter using AG Grid filter APIs?
I have an AG-Grid with columns which use text and number filters. I would like to get the array of values selected in these filters.
Solution 1:[1]
You can use getSelectedNodes() function to get selected rows, Here an e.g. https://stackblitz.com/edit/angular-get-selected-rows
Solution 2:[2]
You can access and set the models for filters through the grid API. You can get the state of all filters using the grid API method getFilterModel()
Here is a reference to ag-grid Filter API
Here is an Example
Update
You can access all the data in grid after the filters have been applied by using forEachNodeAfterFilter.
Here's an example of how to use this method:
const athletes = [];
this.gridApi.forEachNodeAfterFilter((rowNode, index) => {
athletes.push(rowNode.data.athlete);
});
This will give you an array of all the athletes after filters have been applied.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | J.Mas |
| Solution 2 |
