Disable only checkbox

2 posts, 1 answers
  1. Ran
    Ran avatar
    29 posts
    Member since:
    Apr 2015

    Posted 05 Jul 2016 Link to this post

    Hi,

    I need to disable node-checkbox (only the checkbox) and not the whole node.

    this should be work by the prop "available".

    attached example of my code:

    http://dojo.telerik.com/@idoglik6/usIro

    Thanks,

    Ran

  2. Answer
    Stefan
    Admin
    Stefan avatar
    512 posts

    Posted 07 Jul 2016 Link to this post

    Hello Ran,

    Disabling the checkboxes can be achieved by using the checkboxes.template configuration of the Kendo UI TreeView:

    http://docs.telerik.com/kendo-ui/api/javascript/ui/treeview#configuration-checkboxes.template

    I can suggest the following template based on your implementation:

    template: kendo.template(
     "<input type='checkbox' #= item.checked ? 'checked' : '' # #= item.available == false ? 'disabled=\"disabled\"': '' # />"
    )

    Or this is how to control the checkbox display, based on a data item field value.

    template: kendo.template(
     "# if (item.available !== false ) { #" +
     "<input type='checkbox' #= item.checked ? 'checked' : '' # />" +
     "# } #"
    )

    I hope this is helpful.

    Regards,
    Stefan
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top