Kendo UI Angular Grid toggle all checkboxes in a column based on header checkbox select all

1 Answer 55 Views
CheckBox Grid
Ajay
Top achievements
Rank 1
Ajay asked on 21 Jan 2022, 10:42 PM | edited on 21 Jan 2022, 10:44 PM

I am trying to get the checkbox in the column header to cause a change in the state of child checkboxes in the Kendo UI angular grid.

When the header checkbox is checked/unchecked all checkboxes in the column should get checked & unchecked and I also need to catch the event in typescript.

Note: I am not looking to select the entire rows, just trying to check/uncheck the checkboxes in the column.

Below is what I have managed to put together.

https://stackblitz.com/edit/angular-ba65rx

1 Answer, 1 is accepted

Sort by
0
Valentin
Telerik team
answered on 26 Jan 2022, 11:31 AM

Hi Ajay,

Thank you for the provided information.

In order to accomplish the desired behavior an entirely custom checkbox column could be createdUsing the kendoGridHeaderTemplate (for the select all checkbox) and kendoGridCellTemplate (for the row checkbox) will help in implementing the checkbox column.

To get the desired data use the change event of the input tag.

And lastly, to select only the checkbox use the following style to disable the color of the other cells in the table.

    tr.k-state-selected >td, tr.k-alt.k-state-selected  >td {
      background-color: unset !important;
    }
    .k-grid tbody tr:hover {
      background-color: rgba(0, 0, 0, 0.08);
    }
    .k-grid tbody tr.k-alt:hover {
      background-color: rgba(0, 0, 0, 0.08);
    }

Please check the following example demonstrating such an approach:

https://stackblitz.com/edit/angular-l3o3n7-9dbffz

I hope this helps, but in case I am missing something, please do let me know.

Regards,
Valentin
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
Ajay
Top achievements
Rank 1
Answers by
Valentin
Telerik team
Share this question
or