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

How to only allow children to be selectable

3 Answers 249 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 06 Jun 2018, 10:13 PM
How might I make it so only the dropdowntree's leaves are selectable; and clicking parent nodes will either do nothing or expand the nodes?

3 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 07 Jun 2018, 12:41 PM
Hi,

Such behavior van be achieved if we hook to select event of the treeview and allow selection only for some for the items. Here is a sample dojo with jQuery version. In case of MVC DropDownTree the widget should be found and the event bound by using a code similar to the one below in a script tag in the view:
var dropdowntree =  $("#dropdowntree").data("kendoDropDownTree");
        var treeviewSelect = function(e){
                if(e.sender.dataItem(e.node).hasChildren){
                    e.preventDefault()
                }
              };
       
        dropdowntree.treeview.bind("select", treeviewSelect);


Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Mike
Top achievements
Rank 1
answered on 07 Jun 2018, 06:32 PM
Thanks, this solves my issue, however it would be nice if there were an option in the Razor tree declaration to trigger this function in a future release
0
Plamen
Telerik team
answered on 08 Jun 2018, 08:42 AM
Hello,

Thank you for sharing your feedback.

We have not planned such feature for the MVC component so far yet you can submit a feature request about it in our feedback portal here.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownTree
Asked by
Mike
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Mike
Top achievements
Rank 1
Share this question
or