[
https://jira.jboss.org/jira/browse/RF-6545?page=com.atlassian.jira.plugin...
]
Mike Hanafey commented on RF-6545:
----------------------------------
Sorry for the false report. You are correct, my "panelMenuItem" has an
"action", so there is standard navigation.
This menu was in composition where the left menu is fixed, and the content controlled by
the menu is on the right, so this way of showing the last selected menu item just does not
work, but it seems this is exactly the situation you would expect it to work for. I
suppose including the binding attribute is not a big deal, and it seems to give the
desired behavior, but it was not intuitive...
Make you wonder if including binding in other components is a generally useful way of
preserving component state?
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: Tsikhon Kuprevich
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:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira