Hello,
We would like to display the filtered rows count outside of the grid. Currently this is displayed in the class ui-iggrid-results at the bottom of the grid. Is there some kind of event we can handle and is there a way in that event to get the number of "filtered" rows? We would then be able to update a label outside of the grid with the new number.
Kind regards,
Michael
Hello Michael,
I am glad I was able to assist you! Good luck with your project!
Please, don't hesitate to contact me if you have any other questions and/or concerns.
Best regards,
Stamen Stoychev
Thanks a lot for the information Stamen.
Looks good, I'll try it asap.
The event is still perfectly usable, however, the data view is a combination of the filtering expressions and the paging settings. Its size will never exceed the page size while you might have more filtered records. In this case a stable way of obtaining how many records passed the filter is using an internal collection of the data source called _filteredData. The handler in my sample will then look like this:
dataFiltered: function (evt, ui) { $("#filteredRowsLabel").text(ui.owner.grid.dataSource._filteredData.length); }
If you don't want to deal with non-public members I can propose another way. While Filtering and Paging share the same information label and you could completely remove it by setting filterSummaryAlwaysVisible: false for Filtering and showPagerRecordsLabel: false for Paging, instead you can simply hide it with CSS then use its contents to populate your own label. I am attaching a sample demonstrating this approach.
Please, let me know if you have any other questions and/or concerns!
Hello Stamen,
Thanks for the quick reply!
Yes, our scenario will involve Paging. Won't the same "dataFiltered" event nog be usefull with paging ?
The exact solution will depend heavily on whether or not you are using Paging in your application and in which mode Filtering and Paging operate (local or remote). I am attaching a sample for the basic scenario with just Filtering enabled in local mode. When this is the case you can make Filtering not display its summary with the filterSummaryAlwaysVisible option set to false. The number of filtered rows will be the same as the length of the grid's data source data view. The whole Filtering options object will look like this:
{ name: "Filtering", filterSummaryAlwaysVisible: false, dataFiltered: function (evt, ui) { $("#filteredRowsLabel").text(ui.owner.grid.dataSource.dataView().length); } }
Please, let me know if your scenario involves Paging so I can prepare a more suitable sample!
Thank you for using Infragistics forums!