Grid Datasource counts (with filters) without rendering the grid.

1 Answer 177 Views
Grid
jerome
Top achievements
Rank 1
Iron
Iron
jerome asked on 14 Aug 2023, 12:01 PM

Kendo grid with kendo buttons above it which are associated with different Json grid settings (i.e column Filters).
I need to show the row counts for each of these different grid filters inside the buttons so the user understands how many rows these options will contain.  What is the most efficient way to apply the grid filters and get a count against the DataSource without rendering the grid?

 

Merci

1 Answer, 1 is accepted

Sort by
0
Accepted
jerome
Top achievements
Rank 1
Iron
Iron
answered on 24 Aug 2023, 06:44 PM

The answer was to save out the grid filters separate from the json grid settings.

 var grid = $("#mygridID").data("kendoGrid");

 var filters = grid.dataSource.transport.parameterMap({ filter: grid.dataSource.filter() });

 

Then i persisted the string to the db or session.

Then i wrote a dll which i called from my page.

  DataSourceRequest r = new DataSourceRequest();
 r.Filters = FilterDescriptorFactory.Create(strFilterSettings);

** populate results here

results.ToDataSourceResult(r).Total;

 

Tags
Grid
Asked by
jerome
Top achievements
Rank 1
Iron
Iron
Answers by
jerome
Top achievements
Rank 1
Iron
Iron
Share this question
or