Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Niko Humalamäki
"Sticky" submenu bars
March 22, 2012 12:27 AM
Answer

Niko Humalamäki

Rank: New Member

Posts: 16

Join Date: February 21, 2012

Recent Posts

Hi,

Can I somehow get static velocity variables? I'm trying to get the information of the last selected navigation item to the new render phase, in order to be able to have the right submenu open after a 3rd level item has been clicked.

eg. I have a menubar thing like this:

Level1a
Level2a Level2b Level2c
Level3a Level3b Level3d

the things shown on a level depends on the upper level choice (say it is showing the 3rd level of Level2b link). So when one clicks Level3b, I can't get the right 3rd level menu open once browser loads the layout of the page Level3b. So after the click the menu is like:

Level1a
Level2a Level2b Level2c

but the browser is on a 3rd. level page. So is it now time to perhaps learn javascript or where would be a good place to look on this sort of thing?

Now I store the selected nav_item to a velocity variable:

1   
2<ul>
3#foreach ($nav_item in $nav_items)
4        #if($nav_item.isSelected())
5                    #set( $current_nav_item = $nav_item )
6...


and then get it's childern to a 2nd level menulist

1
2<ul>   
3#foreach ($nav_child in $current_nav_item.getChildren())
4        #if ($nav_child.isSelected())
5            #set( $current_child_item = $nav_child)
6...


and finally get the third level items from above variable:

1
2if ( $current_child_item.hasChildren() )
3        <ul>
4            #foreach ($nav_child in $current_child_item.getChildren())
5...

Somehow liferay remebers the toplevel selected navitem after clicking any of the lower level items, but as I already wrote, it doesn't remember the 2nd level selected navitem after a third level item has been clicked.
Niko Humalamäki
RE: "Sticky" submenu bars
March 22, 2012 7:28 AM
Answer

Niko Humalamäki

Rank: New Member

Posts: 16

Join Date: February 21, 2012

Recent Posts

Ok, this is apparrently a bug: http://issues.liferay.com/browse/LPS-16102