kendo-uikendo-treeview

Hide the Root Checkbox in a Kendo TreeView


I know you can use checkbox template to control its look-and-feel but how would I hide the checkbox for the root node (and only the root node)?

UPDATE

The answer below does the trick as well. However, I ended up using a template like this:

checkboxes: {
    checkChildren: true,
    template: "# if(item.Id != 1){# <input type='checkbox'  name='section[#= item.Id #]' value='true' />#} #"
}

"Id" is the id field in my dataSource.


Solution

  • This might do the trick but it is dirty, it's much nicer defining a template:

    $("#treeview").kendoTreeView({
        ...
        checkboxes: true,
        dataBound : function () {
            $("#treeview > ul > li > div span.k-checkbox").hide();
        }
    });
    

    See it running here: http://jsfiddle.net/OnaBai/b3UBh/1/