Hi,
I explain my need :
When the user click on a button, I want to get all data on my grid with filters set on my grid to do an action. I can have a lot of datas (many thousand), in this case, the grid is virtualized.
In this case :
http://dojo.telerik.com/@muadhib/UnEsE/2
I add equal filter in ship country for get all rows where value is France.
When I click on "Get sum Freight", I want to get the sum of all rows which match. In my code, the sum take only 30 rows (1 page) from current page.
What is the best way to perform that ?
Regards.
6 Answers, 1 is accepted
I have found a solution :
var
dataSource = $(
"#grid"
).data(
"kendoGrid"
).dataSource;
var
filters = dataSource.filter();<br>
var
allData = dataSource.data();
var
query =
new
kendo.data.Query(allData);
var
data = query.filter(filters).data;
Indeed, querying over all items with the current filter configuration, and ignoring the paging, is the only way to achieve the desired functionality. Please note that using this approach can potentially cause performance issues for very large data sets.
Let us know if you have other Kendo UI-related questions.
Regards,
Dimiter Topalov
Telerik by Progress
Does this code still work today? I'm trying with Kendo UI for MVC, 2019 January release and can only get the first ten records from my result. Coincidentally, I've also got local side paging set to 10 as well.
How can one iterate through all filtered rows when they have paging enabled?
It turns out that I was specifiying this in my Kendo Grid setup. Using this puts the DataSource in server pagination mode and no matter what, you cannot get the remaining rows unless you change your page size. Since I am only doing local pagination I removed this attribute and everything worked perfectly.
DataSource(ds => ds.Ajax()
.ServerOperation(true)
It is correct that when the server operations of the Kendo UI Grid are enabled, you can access only the items which are loaded only the current page. This is done for performance purposes. If you would like to have access to all of the items in the data source, set the ServerOperation() property to false. This would force the grid to request all of the items in the data source the first time you load the grid.
Let me know in case further information is required.
Kind regards,
Tsvetomir
Progress Telerik