Get the number of filtered rows when using AgGrid
I'm trying to get the number of filtered rows when using the AgGrid. I've found that this should be available as
getAgGrid("myTable").api.getDisplayedRowCount()
, but when using this in a templated text it does not update. The problem seems to be that the text component depends on myTable.selectedRows and myTable.result (I also print the total count and the selected count in the same text. But it has no dependency that makes it re-render when the filtering changes.
Is there anything I can do to make it update on filter changes?5 Replies
Hi, you can make a frontend script that will read the displayedRowCount and configure it to trigger anytime some dependency changes (for example your filters). You can then use the result of the frontend script in your templated text.
Hm, it's the trigger I can't figure out. It seems agGrid has a filterChanged event which could achieve this, but I'm not sure how to hook up the filterChange event with the frontend script?
Are the filters internal to Ag Grid? Sorry I misunderstood that. Let me check again and I'll get back to you
I've made a PR to expose both the state of the filters and the displayedRowCount in the output of the component:
https://github.com/windmill-labs/windmill/pull/3101/files
Oh that's awesome @Faton ! Looking forward to it being merged!