JJ.
JJ.

Reputation: 9970

How do I check all check boxes in a Kendo UI TreeView (parents and children nodes) based on a button click?

This only checks the parent nodes:

$(function()
{
    $('#chkSelect').change(function()
    {
        if (this.checked)
        {
            $('#treeview input[type="checkbox"]').prop('checked', true);
        }
        else
        {
            $('#treeview input[type="checkbox"]').prop('checked', false);
        }
    });
});

Please note that the children nodes may or may not be expanded.

Upvotes: 0

Views: 4132

Answers (1)

JJ.
JJ.

Reputation: 9970

Figured out how to do it:

var treeView = $("#treeview").data("kendoTreeView");
    var userId = $('#user_id').val();

    $('#treeview').find('input:checkbox:checked').each(function()
    { ...

Upvotes: 1

Related Questions