Vertical Navigation(Tree View) - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Vertical Navigation(Tree View)

  • 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>

    Regards,
    Svetoslav Manchev
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items