This is a migrated thread and some comments may be shown as answers.

Disable only checkbox

1 Answer 896 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ran
Top achievements
Rank 1
Ran asked on 05 Jul 2016, 08:38 AM

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

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 07 Jul 2016, 07:46 AM
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.
Tags
TreeView
Asked by
Ran
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or