Search code examples
c#asp.net-mvckendo-treeview

How to give checkbox only for parent nodes and not for child nodes in kendo treeview?


// please do refer this below link and let us know the answer

Visit http://demos.telerik.com/aspnet-mvc/treeview/checkboxes


Solution

  • To show checkboxes next to parent nodes (e.g. folders) and not next to child nodes (e.g. files), you can use a checkbox template as suggested in this related SO answer: https://stackoverflow.com/a/13848460/1805328

    Just use a checkbox template of:

    template: "# if(item.hasChildren){# <input type='checkbox'  name='checkedFiles[#= item.id #]' value='true' />#}#"
    

    This creates an input of type='checkbox' only for items that have children.

    Here's the JSBin example.