You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by janw <ja...@gmx.de> on 2006/08/23 17:12:42 UTC
CommandNavigation2: usage of "activeOnViewIds" attribute
Hello,
I tried to use the attribute "activeOnViewIds" of the component
"commandNavigation2" to define which menu items are open after which action,
but don't get it wo work.
I don't know exactly how to fill the attribute.
A view-id is sth like "/order_overview.jsp", as in a navigation rule, right?
I tried:
<t:panelNavigation2 layout="list" ...>
<t:commandNavigation2 action="order_overview"
activeOnViewIds="/create_order.jsp;"
value="...">
I'd like the menu item to be open when the user is in the view
/create_order.jsp;
I'm using myfaces 1.1.3 with tiles.
Please advice.
Jan
--
View this message in context: http://www.nabble.com/CommandNavigation2%3A-usage-of-%22activeOnViewIds%22-attribute-tf2152984.html#a5946383
Sent from the MyFaces - Users forum at Nabble.com.
Re: CommandNavigation2: usage of "activeOnViewIds" attribute
Posted by janw <ja...@gmx.de>.
Hello,
I found out how it works.
The syntax must be like this:
<t:commandNavigation2 activeOnViewIds="/leer.jsp" ...>
activeOnViewIds="/leer.jsp;" will not work.
I looked at the code of the class UINavigationMenuItem and I think I found
out why.
If there is one view-Id / token that matches, the if condition evaluates to
true.
If there is a subsequent view-id/token that won't match the else-clause
deactivates this menuItem again.
Am I right?
If so, only one activeViewId is possible per MenuItem.
Jan
The code from rg.apache.myfaces.custom.navmenu.UINavigationMenuItem:
public void toggleActive(FacesContext context) {
StringTokenizer tokenizer = new
StringTokenizer(this.getActiveOnViewIdsDirectly(), ";");
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (token.trim().equals(context.getViewRoot().getViewId())) {
this.deactivateAll();
this.setActive(true);
openParents();
}
else {
this.setActive(false);
}
}
}
--
View this message in context: http://www.nabble.com/CommandNavigation2%3A-usage-of-%22activeOnViewIds%22-attribute-tf2152984.html#a6077341
Sent from the MyFaces - Users forum at Nabble.com.