Expand disabled nodes

1 Answer 13 Views
TreeView
Frank
Top achievements
Rank 1
Iron
Frank asked on 04 Mar 2024, 07:45 AM

Is there a way to expand disabled nodes in the treeview component? There was a solution (https://www.telerik.com/forums/expand-disabled-nodes) but with the current version of kendo-ui it does not work anymore.

It seems that the expand/collapse icon is now disabled as well and it does not fire any event. Is there another solution to make this work again?

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Mar 2024, 07:09 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
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources
Frank
Top achievements
Rank 1
Iron
commented on 07 Mar 2024, 09:05 AM

Hi Nikolay,

thanks for your answer! This solves the Problem we had with the new Kendo UI Version.

Regards

Frank

Nikolay
Telerik team
commented on 12 Mar 2024, 07:45 AM

Hi Frank,

You are most welcome.

Please let us know if anything new arises.

Regards,

Nikolay

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