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

Expand disabled nodes

4 Answers 368 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Frank
Top achievements
Rank 1
Iron
Frank asked on 01 Aug 2017, 07:43 PM

Is it possible to expand disabled nodes. I have the following scenario:

- parent 1 (enabled and selectable)

     + child 1.1 (disabled and not selectable)

           + child 1.1.1 (enabled and selectable)

So I need a treeview where i can select different nodes individually. Right now when i disable a node i cannot access any child nodes.

4 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 03 Aug 2017, 10:29 AM
Hi Frank,

A disabled node can be expanded programmatically through the TreeView's expand method. Here's a dojo example, which demonstrates the use of this method by expanding the "Nissan" disabled node.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Frank
Top achievements
Rank 1
Iron
answered on 03 Aug 2017, 10:57 AM

Hi Ivan,

thanks for answering my question. But i'm afraid that is not really what i was looking for. I need the ability to expand and collapse disabled nodes by mouse klick in the tree (just like enabled nodes).

0
Ivan Danchev
Telerik team
answered on 04 Aug 2017, 03:24 PM
Hi Frank,

This behavior is not available out-of-the-box but here's a dojo example that shows how to achieve it through jQuery and the TreeView's methods.

Regards,
Ivan Danchev
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Accepted
Frank
Top achievements
Rank 1
Iron
answered on 07 Aug 2017, 06:34 AM

Hi Ivan,

that is exactly the behaviour i was looking for! Thank you very much!

 

Regards

Frank

Frank
Top achievements
Rank 1
Iron
commented on 29 Feb 2024, 11:05 AM

Sorry to unaccept this Answer. But I'm afraid with the new Kendo UI version your solution does not work anymore! It seems that the expand/collapse arrow is now disabled and the onclick event-handler does not work anymore.

Is there a solution for this problem?

Nikolay
Telerik team
commented on 04 Mar 2024, 11:49 AM

Hi Frank,

the TreeView nodes rendering has changed since 2017 and indeed, the logic for enabling the expansion of disabled items is no longer valid. You can use the below logic with newer versions of Kendo UI:

      $(document).ready(function() {
        $(".k-treeview .k-treeview-toggle.k-disabled").removeClass("k-disabled");

        $(".k-treeview .k-treeview-toggle").click(function(e) {
          var treeview = $("#treeview").data("kendoTreeView");

          if($(e.currentTarget).find(".k-toggle-icon").hasClass("k-svg-i-caret-alt-right")) {
            treeview.expand($(e.currentTarget).parent().parent());

          }
          else {
            treeview.collapse($(e.currentTarget).parent().parent());
          }
          $(".k-treeview .k-treeview-toggle.k-disabled").removeClass("k-disabled");
        })
      });

Dojo demo: https://dojo.telerik.com/iNEDACEw

Regards,

Nikolay

Tags
TreeView
Asked by
Frank
Top achievements
Rank 1
Iron
Answers by
Ivan Danchev
Telerik team
Frank
Top achievements
Rank 1
Iron
Share this question
or