How to only allow children to be selectable

4 posts, 1 answers
  1. Mike
    Mike avatar
    2 posts
    Member since:
    Mar 2016

    Posted 06 Jun 2018 Link to this post

    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?
  2. Answer
    Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 07 Jun 2018 Link to this post

    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.
  3. Mike
    Mike avatar
    2 posts
    Member since:
    Mar 2016

    Posted 07 Jun 2018 in reply to Plamen Link to this post

    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
  4. Plamen
    Admin
    Plamen avatar
    2958 posts

    Posted 08 Jun 2018 Link to this post

    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.
Back to Top