This content has been marked as final.
Show 3 replies
-
1. Re: PanelMenu problem with dynamic creation of menu items
nbelaevski Jan 8, 2008 12:51 PM (in response to crisyag)Please provide some more info
-
2. Re: PanelMenu problem with dynamic creation of menu items
crisyag Jan 9, 2008 6:41 AM (in response to crisyag)Hello Nick, thanks for your answer.
I have changed my code to use a h:PanelGrid with SimpleTogglePanels instead of PanelMenu, but I still have the same problem, some panels are not created dynamically, others replaces previous ones.
I have a tree, each node is a commandLink:<a4j:commandLink reRender="chatTestPanel" value="#{contact.name}" action="#{ContactList.actionContactClick}"> <a4j:actionparam name="selectedContact" value="#{contact.id}"/> </a4j:commandLink>
In backing bean I add a new SimpleTogglePanel to a PanelGrid in the method ContactList.actionContactClick:public void actionContactClick() { String contactId = (String)FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("selectedContact"); HtmlSimpleTogglePanel panel = new HtmlSimpleTogglePanel(); panel.setLabel(contactId); panel.setOpened(false); panel.setId("id_" + this.idCount); panel.setSwitchType("client"); this.chatWindowPanelGrid.getChildren().add(panel); this.idCount++; }
In the code above, this.chatWindowPanelGrid is binded to a h:PanelGrid defined in jsp. This PanelGrid is empty at first and then is filled by the previous method. The problem is that some panels are not added to this.chatWindowPanelGrid.getChildren() and sometimes panels are replaced. I tried an alternative solution, at least is working but I need to test more. I have a list called chatList in my backing bean that keeps the chatWindowPanelGrid children:this.chatList.add(panel); chatWindowPanelGrid.getChildren().clear(); chatWindowPanelGrid.getChildren().addAll(chatList);
By doing this, chatWindowPanelGrid contains all panels added in the correct order. So, the problem is related to the children list of PanelGrid, the same problem I had with PanelMenu children.
Again, thanks for the help.
Cristiane Yaguinuma. -
3. Re: PanelMenu problem with dynamic creation of menu items
nbelaevski Jan 9, 2008 5:45 PM (in response to crisyag)Hmm, I do not see anything that could cause the problem. Could you please prepare sample project to see the problem? You can send it to nbelaevski at exadel dot com