Checkbox Selection Is Not Working for Custom Grids
Environment
Product | Progress® Kendo UI® Grid for jQuery |
Operating System | Windows 10 64bit |
Browser | Google Chrome |
Browser Version | 60.0.3112.113 |
Description
I want to use the new checkbox-selection feature of the Grid. However, when I click on the checkbox in the header, the checkboxes of the Grid rows are not selected and when I do the paging, the Grid doesn't persist the checkboxes that were selected from other pages.
How can I extend the kendo.ui.Grid
class and implement the checkbox selection in the Grid?
Cause
Two of the private methods internally reference the Grid. As the widget is now called kendoMyGrid
, the result is undefined
and the additional logic is not executed.
checkBox.closest(".k-grid.k-widget").data("kendoGrid")
// now it should be
checkBox.closest(".k-grid.k-widget").data("kendoMyGrid")
Solution
Overwrite the two methods. Note that because the methods are private, their modification might cause unexpected behavior.
For the complete implementation of the approach, refer to this runnable example.