问题
I have an ag-Grid with filtering option.
How to get the number of filtered rows without using forEachNodeAfterFilter
callback?
I want to enable a button only if there is a filtered row, and i don't want to perform a foreach loop in the background every time.
回答1:
gridOptions.api.getModel().rootNode.childrenAfterFilter.length
You should check out what else is available to you under rootNode
, there are a few arrays that might be useful to you
回答2:
What you are probably looking for is:
gridOptions.api.getDisplayedRowCount()
The actual number of rows after the filtering event is trivially the number of displayed rows.
来源:https://stackoverflow.com/questions/43542998/how-to-get-the-number-of-filtered-rows-in-ag-grid