Reputation: 39268
I have a question about how the Telerik grid stores data internally after fetching it as part of infinite scroll operations. I am using the remote virtualization mode and fetch new records through Ajax calls.
I am able to access the data set that is currently bound to the grid through:
$("#Grid").data().kendoGrid.dataSource.view()
As expected the grid makes an Ajax request to request new pages, but it seems to store data for previous pages in an object somewhere. Is there a way to acccess that object through the cient side API? Meaning can I view all the data for all the pages that were requested by the grid (not just the current page)?
I have also noticed that the grid will often make the same Ajax request twice during scrolling (for the same page number). Is there a way to prevent this since the duplicate request seems to return the same data as the previous one.
Upvotes: 3
Views: 809
Reputation: 20213
All the data is stored in chunks of data called "ranges" within the internal _ranges array.
You can cycle through all the loaded data like this:
var chunks = $('#gridName').data().kendoGrid.dataSource._ranges
for(var i=0;i<chunks.length;i++){
for(var j=0;j<chunks[i].data.length;j++){
console.log(chunks[i].data[j])
}
}
Regarding the multiple same requests - I think this is addressed and if it is not already fixed in the latest internal build it should be in the nearest releases.
Upvotes: 1