Vertical Navigation(Tree View)
Hi., I am using vertical navigation with sub levels widget template and I selected custom pages for navigation and included in page template. I am getting top level pages as well as child pages. I want only top level navigation child pages needs to collapse default when ever we click on top level page the child pages needs to be expanded.
Any suggestions thanks in advance.
Hi Nagesh,
If I correctly understand your need, below is the code snippet that you can use in order to keep open only the node where the subpage is open. Short video demonstration how it works is available here.
<
script
type
=
"text/javascript"
>
(function ($)
var kendoTreeView = $('.sfNavTreeview').not('div.k-treeview .sfNavTreeview').kendoTreeView(
animation: false,
expand: function(e)
var clicked = e.node;
var sibling = clicked.nextElementSibling;
while (sibling)
kendoTreeView.collapse(sibling);
sibling = sibling.nextElementSibling;
sibling = clicked.previousElementSibling;
while (sibling)
kendoTreeView.collapse(sibling);
sibling = sibling.previousElementSibling;
).data('kendoTreeView');
//kendoTreeView.expand(kendoTreeView.element.find(".k-item"));
)(jQuery);
</
script
>