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

Collapse Nodes on Click

7 Answers 136 Views
Navigation
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 2
Jeff asked on 10 Mar 2015, 04:46 PM
Is it possible to collapse a node when one of the nodes below are clicked?  I have a navigation control with multiple nodes with some nodes having "sub" nodes.  When one of the sub nodes are clicked the page does what I want (navigate a separate panel to a new page) but the node stays expanded unless another parent node is clicked on the navigation control itself is clicked.
Thanks,
Jeff

7 Answers, 1 is accepted

Sort by
0
Jeff
Top achievements
Rank 2
answered on 12 Mar 2015, 02:01 PM
Some more information.  I had a RadSplitter with two RadPanes, when I had the RadNavigation in Pane1 and clicked on an item, I would open a separate page in Pane2, clicking in Pane2 did not collapse the RadNavigation, I had to click anywhere in Pane1 to collapse the RadNavigation.  I stopped using the splitter and it seems OK now.  It would be nice to have the option to have the Nodes auto-collapse after being clicked.
Thanks,
Jeff
0
Accepted
Ivan Danchev
Telerik team
answered on 12 Mar 2015, 04:22 PM
Hello,

To make the RadNavigation nodes collapse on click you can subscribe to the control's OnClientNodeClicked event and call the _collapseAll method in its event handler as shown below:
function OnClientNodeClicked(sender, eventArgs) {              
    if (eventArgs.get_node().get_level() > 0) {
         sender._collapseAll();
    }
}

<telerik:RadNavigation ID="RadNavigation1" runat="server" OnClientNodeClicked="OnClientNodeClicked">

Regards,
Ivan Danchev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Jeff
Top achievements
Rank 2
answered on 20 Mar 2015, 01:31 PM
Thanks Ivan, worked perfectly!
0
Jon
Top achievements
Rank 1
answered on 01 Feb 2016, 08:57 PM

Hi Ivan,

This technique doesn't appear to work on  the hamburger menu when there is a second level.  It closes the second level but NOT the main hamburger menu.  How do you force that to hide?

Regards

Jon

0
Jon
Top achievements
Rank 1
answered on 01 Feb 2016, 09:06 PM

Ah, I've realised that the hamburger isn't a normal node and that would explain it not collapsing.  I've now found the _collapseSandwich function and used that, works very well now.  

Is this going to be added as a proper function so that it doesn't get dropped after any internal rewrites?  I always get worried about using the underscore functions.

Regards

Jon

0
Plamen
Telerik team
answered on 04 Feb 2016, 07:25 AM
Hi Jon,

Thank you for your concern with RadControls - we will do our best to add public methods for expand and collapse of the MenuButton or the "sandwich" as soon as possible.

Regards,
Plamen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jon
Top achievements
Rank 1
answered on 08 Feb 2016, 07:57 AM

Many thanks Plamen

Regards

Jon

Tags
Navigation
Asked by
Jeff
Top achievements
Rank 2
Answers by
Jeff
Top achievements
Rank 2
Ivan Danchev
Telerik team
Jon
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or