How to get a number of items in a filtered data grid?

Hi, how can I get and use the number of items in a data grid currently displayed on the page (not the total amount of items in a collection)? Do they get stored in some variable?

I’m using filters on a data grid itself:

Here is an example how the page looks like with no filters applied:

And with some filters:

I don’t use the backend filtering and don’t want to fetch a collection each time a user changes filters or uses search (I have less then 100 records, so it wouldn’t make sense, also from the UX perspective).

I’ve found this topic in the community: Number of filtered items - #2 by Joyce but can’t apply this to my case. Chatting with the copilot gave no results.

I’d appreciate your help!

Hi @polina_cigen :wave:

If your filters are configured on the data grid itself, you won’t be able to access that information unfortunately.

Depending on the data source you are using, you can add those same frontend filters at collection level, AFTER the data is fetched:

In that case, you will be able to see the total of items after the filter.

Does that make sense?

1 Like

Hi @Joyce , thank you for your answer!
Unfortunately, it doesn’t help. When I moved the filtering from the data grid to the collection level, the dynamic frontend filtering that I previously had stopped working. To make it work and to display the total of items after the filter - now I need to refetch the collection every time a user applies filters. But it’s the same as having the backend filtering, because I need to send a request to a server each time a user changes values in the fields.

If I understood correctly from my previous research and from your answer, if I want to show the total after the filtering, then I must refetch the collection. So I’ll consider adding the “Aplly filters” button to make it more user-friendly.