Hi have a JS function that is used to loop through the data of a multipage grid. This following function should loop 3 times, but it stops after the second loop. What am I doing wrong?
The following
function GetAnimalsUsingFilters() {
var dataSource = $("#view-GenomicEvaluationInventory-grid").data("kendoGrid").dataSource;
var totalPages = 3;
var targetPage = 1;
while (targetPage <= totalPages) {
dataSource.query({ page: targetPage, pageSize: 20, filter: dataSource.filter() })
.then(function() {
var view = dataSource.view();
var viewItemId = 0;
while (viewItemId < view.length) {
filteredAnimals.push(view[viewItemId]['AnimalId']);
viewItemId++;
}
//Callback when done
if (targetPage === totalPages) {
GeneratePDFReport(dataSource);
}
});
targetPage++;
}
}
Or better yet, if you are familiar with Kendo grid, is there another way to get the filtered(column filtered) results across multiple pages?