-
1. Re: rich:panelBar and selectedPanel
ilya_shaikovsky Apr 27, 2010 6:58 AM (in response to pomcompot)1 of 1 people found this helpfulif you will explore demo code more - you will see that component id always added to request parameters and getter for selectedPanel object searches for the group which contains it and return group id. So no support needed. Your code also looks ok. After any submit - selected panel id wil be placed into object and will be stiored beteween requests.
-
2. Re: rich:panelBar and selectedPanel
pomcompot Apr 30, 2010 8:22 AM (in response to ilya_shaikovsky)So, I explore deeper the demo code and indeed I found the c parameter you talk about.
I have succeeded in getting the right behavior with this code in the JSF:
<a4j:form>
<rich:panelBar style="width: auto;"
selectedPanel="#{sidebarController.currentGroup}"
height="540px"
contentStyle="background:none;">
<rich:panelBarItem id="deploiements" label="Déploiements">
<a4j:support event="onenter"
immediate="false"
actionListener="#{sidebarController.handleMenuChange}" />
[…]
</rich:panelBarItem>
[…]
</rich:panelBar>
</a4j:form>And this in my bean:
@Name("sidebarController")
@Stateful
@Scope(ScopeType.SESSION)
@AutoCreate
public class SidebarControllerBean implements SidebarController {
private static final long serialVersionUID = 7924870476939863030L;
private String currentGroup = null;
@Destroy
@Remove
public void destroy() {
}public void setCurrentGroup(String currentGroup) {
this.currentGroup = currentGroup;
}public String getCurrentGroup() {
return currentGroup;
}
public void handleMenuChange(ActionEvent event) {
this.currentGroup = event.getComponent().getParent().getId();
}
}The selectedPanel without the a4j:support call the setCurrentGroup but not with the right value. It call it with the id of the previously selected menu item, one step too late.