-
1. Re: [RF 4.3.5.final] panelmenu loses selected menuItem
michpetrov May 22, 2014 9:27 AM (in response to tatatanja)Hi,
I tested that and it works fine for me. What does your menu look like?
-
2. Re: [RF 4.3.5.final] panelmenu loses selected menuItem
tatatanja May 23, 2014 2:24 AM (in response to michpetrov)My xhtml:
<ui:composition lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich" mlns="http://www.w3.org/1999/xhtml">
<h:head />
<h:body>
<h:panelGrid border="0" columns="2" columnClasses="colNavigation,colContent">
<h:panelGroup>
<rich:panel styleClass="navigationPanel">
<h:form>
<div class="applicationName">
<h:outputText value="Example" />
</div>
<rich:panelMenu expandSingle="false" itemMode="server" groupMode="server" >
<rich:panelMenuGroup label="Person" expanded="true" >
<rich:panelMenuItem label="#{msg['menuPage.new']}" action="#{personController.newPerson}" >
</rich:panelMenuItem>
<rich:panelMenuItem label="#{msg['menuPage.list']}" action="list">
</rich:panelMenuItem>
</rich:panelMenuGroup>
</rich:panelMenu>
</h:form>
</rich:panel>
</h:panelGroup>
<h:panelGroup>
<ui:insert name="content">
<h:outputText value="#{msg['menuPage.welcome']}" />
</ui:insert>
</h:panelGroup>
</h:panelGrid>
</h:body>
</ui:composition>
and the action:
public String newPerson() throws Exception {
try {
this.logger.trace("newPerson(): Method started.");
this.newPerson = new Person();
this.disableInput = false;
return "newPerson";
} catch (Exception e) {
throw e;
}
}
and the faces-config.xml:
<navigation-rule>
<from-view-id>*</from-view-id>
<navigation-case>
<from-outcome>newPerson</from-outcome>
<to-view-id>/views/personNew.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
and my personNew.xhtml defines the <ui:define name="content">
Regards
-
3. Re: Re: [RF 4.3.5.final] panelmenu loses selected menuItem
michpetrov May 23, 2014 4:01 AM (in response to tatatanja)If you're changing pages then the panelMenu you see after clicking the link is a different copy, so it cannot remember what you clicked. You have to keep track of what the selected item should be - use @activeItem, its value has to be equal to the @name of the menu item.
<rich:panelMenu expandSingle="false" itemMode="server" groupMode="server" activeItem="#{personController.page}" > <rich:panelMenuGroup label="Person" expanded="true" > <rich:panelMenuItem label="#{msg['menuPage.new']}" name="#{msg['menuPage.new']}" action="#{personController.newPerson(msg['menuPage.new'])}" /> <rich:panelMenuItem label="#{msg['menuPage.list']}" action="list" /> </rich:panelMenuGroup> </rich:panelMenu>
public String newPerson(String page) throws Exception { this.page = page; … }