Indeterminate state for Kendo Grid Checkboxes

1 Answer 268 Views
Checkbox Grid
Benjamin
Top achievements
Rank 2
Iron
Iron
Veteran
Benjamin asked on 04 Jul 2022, 03:22 AM

i saw from the Kendo UI for Jquery Kendo Grid page is able to achieve the indetermindate state for checkbox but i cant seems to find how do i do it?

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi
Telerik team
answered on 06 Jul 2022, 12:09 PM

Hello Benjamin,

Thank you for your question!

I assume that you want to achieve indeterminate state for the main checkbox in the header of the grid. Indeed, it is possible and you can do that by using the change event of the Grid. Below, I am sending you the modifications you can try: 

function onChange(arg) { let grid = $("#grid").data("kendoGrid"); let selectedRowsCount = grid.select().length; let pageSize = grid.dataSource.pageSize(); if(selectedRowsCount > 0 && selectedRowsCount < pageSize){ $(".k-grid-header .k-checkbox").prop("indeterminate", true); } else{ $(".k-grid-header .k-checkbox").prop("indeterminate", false); }

}

The following Dojo demonstrates the full implementation of the above logic:

Untitled | Kendo UI Dojo (telerik.com)

Let me know if this works for you or if you have any questions. 

Regards, Georgi Slavov Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Checkbox Grid
Asked by
Benjamin
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Georgi
Telerik team
Share this question
or