rich:panelMenu rich:panelMenuItem requires binding to remember
selected item state
----------------------------------------------------------------------------------
Key: RF-6545
URL:
https://jira.jboss.org/jira/browse/RF-6545
Project: RichFaces
Issue Type: Bug
Affects Versions: 3.3.0
Reporter: Mike Hanafey
Assignee: Nick Belaevski
Fix For: 3.3.1
In the example below, the backing bean is session, but it does nothing with the
"binding" property (other than store the value). If "binding" is
omitted, then the selected state of the panel menu items is not maintained, but it seems
this should be part of the saved component state. Without "binding" if item
"el" is clicked, the label momentarily turns purple, but when the view is
restored it turns back to the plain state. When "binding" is present, each item
that is clicked turns purple, and stays purple.
<rich:panelMenu id="sideMenu" style="width:100%"
mode="server" binding="#{MainToolBar.settingsMenu.panelMenu}"
iconExpandedGroup="disc" iconCollapsedGroup="disc"
iconExpandedTopGroup="chevronUp"
iconGroupTopPosition="right"
iconCollapsedTopGroup="chevronDown">
<rich:panelMenuItem id="el" label="Report Sections"
action="#{MainToolBar.settingsMenu.actionReportSectionSettings}"/>
<rich:panelMenuItem id="snl" label="A stubbed"
action="#{MainToolBar.settingsMenu.actionReportSectionSettings}"/>
</rich:panelMenu>
The problem was traced as far as org.richfaces.renderkit.html.PanelMenuItemRenderer,
where "parentMenu.getSelectedName()" always returns the empty string if
"binding" is not present.
public boolean isSelected(FacesContext context, UIComponent component){
UIPanelMenuItem item = (UIPanelMenuItem)component;
UIPanelMenu parentMenu = findMenu(item);
return item.getName().equals(parentMenu.getSelectedName());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: