I have persistSelection enabled, how do I clear previous selected checkboxes upon .read()?

0 Answers 84 Views
Grid
Philip
Top achievements
Rank 1
Veteran
Iron
Philip asked on 05 Apr 2022, 10:38 PM | edited on 05 Apr 2022, 10:43 PM

I have followed this guide on how to add checkboxes to the Kendo Grid and have it persist the checkbox states. I also have a Reload button that calls $("#grid").data("kendoGrid").dataSource.read(); when clicked.

The data reloads properly but the checked checkboxes from the previous grid is still retained. How do I have set it so that the checkboxes for the grid will all be unchecked upon clicking the Reload button defined above?

A possible solution I've found is to set all checkboxes to unchecked before calling .read() function. But I have about 8000 records in the grid so running this code will take more than thirty seconds. I've found this function grid.clearSelection(); but it only clears the current page's checkboxes and leaves the subsequent pages checked.

So my question is, is there a fast way have the grid not retain the previous selected checkboxes when the Reload button is clicked?

 

Update:

I've found the following guide on how to clear selections across all pages. I've tested and the performance is fast. Thank you for your interest in viewing this post.

var grid = $("#grid").data("kendoGrid");
grid._selectedIds = {};
grid.clearSelection();

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Philip
Top achievements
Rank 1
Veteran
Iron
Share this question
or