a4j:included rich:panelMenu not reRendering
bp2s Dec 2, 2010 12:27 PMHello
I have a top level xhtml JSF page (3.3.2.SR1) which has in it another a4j:include'd xhtml JSF (controls) page with a tabMenu. One of the tabs a4j:includes a further page. This last page has a panelMenu.
In the top level page is a commandButton which, when hit, reRenders a load of elements.
I've noticed that when I hit the commandButton a second (and successive) time, the panelMenu is not reRendering properly - it seems to try and amalgate both sets of elements into one. I want to refresh it but when the commandButton gets pressed.
I tried to include the id of the panelMenu in the commandButton reRender attribute, and as expected the first time the button is hit I get a warning as the panelMenu id is not known at that time - this is fine for me. But when I hit it again, there's no warning and I expected it to be reRendered and it is was not - it's still amalgamating both the old elements and the new.
I have my panelMenu mode set to ajax. I dont want to use server as this refreshes the whole page and I'm trying to create a webapp which works on 1 page rather than uses a series.
How can I get just my (buried) panelMenu updated when a commandButton above it in the node tree is pressed?
For reference, here is some of the code:
Top level button:
<rich:toolBarGroup location="left"> <a4j:region id="rb"> <a4j:form name="nodeSelectForm"> <h:panelGrid columns="5"> <h:outputText style="text-align: center" value="Node Select " /> <h:selectOneMenu id="nodes" value="#{MyBacking.chosenNode}"> <f:selectItems value="#{MyBacking.nodes}" /> </h:selectOneMenu> <a4j:commandButton value="Retrieve" styleClass="ctrlBtn" id="retrieveBtn" reRender="lp,contentPanel" image="/img/btnRetrieve26.png" /> </h:panelGrid> </a4j:form> </a4j:region> </rich:toolBarGroup>
contentPanel:
<rich:panel id="contentBox"> <h:panelGroup layout="block" id="contentPanel"> <a4j:region> <a4j:include viewId="#{MyBacking.viewId}"> <f:param name="targetIdParam" value="content" /> </a4j:include> </a4j:region> </h:panelGroup> </rich:panel>
MyBacking.viewId returns the xhtml page with this in:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:c="http://java.sun.com/jstl/core"> <a4j:region id="nodeConfig"> <h:panelGrid columns="1"> <rich:tabPanel switchType="ajax" rendered="true"> <rich:tab styleClass="tab" label="Node Logs"> <a4j:include viewId="nodeConfigNodeLogs.xhtml"/> </rich:tab> </rich:tabPanel> </h:panelGrid> </a4j:region> </ui:composition>
And in my nodeConfigNodeLogs.xhtml:
<h:form> <a4j:region id="logs"> <h:panelGrid columns="2"> <rich:panel> <a4j:region id="lpr"> <rich:panelMenu mode="ajax" id="lp"> <c:forEach items="#{MyBacking.panelNodes}" var="map"> <rich:panelMenuGroup label="#{map.value.shortLogName}"> <c:forEach items="#{map.value.logs}" var="log"> <rich:panelMenuItem label="#{log.key}" action="#{MyBacking.updateCurrent}" reRender="sysMsg"> <f:param name="current" value="#{log.value}" /> </rich:panelMenuItem> </c:forEach> </rich:panelMenuGroup> </c:forEach> </rich:panelMenu> </a4j:region> </rich:panel> snip </h:panelGrid> </a4j:region> </h:form>
Any help massively appreciated.