Incorrect data update of rich:panelMenu
shmu80 Apr 16, 2015 12:53 AMHi,
I found the current item update in rich:panelMenu is late and incorrect. Below is my code.
sideNavi.xhtml
<rich:panelMenu itemMode="ajax" groupMode="ajax" groupExpandedLeftIcon="triangleUp"
groupCollapsedLeftIcon="triangleDown" topGroupExpandedRightIcon="chevronUp"
topGroupCollapsedRightIcon="chevronDown" itemLeftIcon="disc" itemChangeListener="#{navBean.updateCurrent}"
activeItem="#{navBean.current}">
<rich:panelMenuGroup id="accessRight" label="Access Right">
<rich:panelMenuItem id="roleMain" label="Role" action="#{roleBean.init}"/>
</rich:panelMenuGroup>
<rich:panelMenuGroup id="information" label="Information">
<rich:panelMenuItem id="categoryMain" label="Category" action="#{categoryBean.init}"/>
</rich:panelMenuGroup>
</rich:panelMenu>
NavBean.java
public class NavigatorBean implements Serializable {
private static final Logger logger = Logger.getLogger(NavigatorBean.class
.getName());
private static final long serialVersionUID = -3570134693650857646L;
private String current;
private boolean singleMode;
public boolean isSingleMode() {
return singleMode;
}
public void setSingleMode(boolean singleMode) {
this.singleMode = singleMode;
}
public String getCurrent() {
return this.current;
}
public void setCurrent(String current) {
this.current = current;
}
public void updateCurrent(ItemChangeEvent event) {
if (logger.isLoggable(Level.INFO)) {
logger.info("Current event item name: " + event.getNewItemName());
}
setCurrent(event.getNewItemName());
}
}
The situation:
- I have 2 rich:panelMenuItem, category and role.
- When I click on category, no data log.
- After that when I click on Role, the log wil display "Current event item name: roleMain" and then follow by "Current event item name: categoryMain", so the activeItem will jump to categoryMain even I just click on Role.
Please advise.