views:

141

answers:

1

I have two forms on a page. One form, on the left, is a tree and the other form, on the right, is a detail form that changes its content based on the node selected in the tree.

All interaction with the forms is done via ajax.

I have the reRender of the detail form working just fine when the user selects a node in the tree. However, when the user makes a change in the detail form and clicks a save button that corresponds to the node's text, the reRender of the tree does not appear to happen. However, if I actually refresh (F5) the page the change is then reflected in the tree.

Is there something special about a tree and getting it to re render its nodes?

Adding code; it is somewhat difficult to concisely show the code as I'm using facelets and have a number of templates that piece together the screen...

The right-hand/detail form on the page looks like this:

    <a4j:form id="form_#{tab_name}" ajaxSubmit="true">
    <h:panelGrid id="tabWrapper" columns="1" style="width:100%">
        <h:panelGroup style="float:right;">
            <h:outputLabel value="Node:" />
            <ui:repeat value="#{controller.selectedNode.ancestry}" var="node">
                <h:outputText value="&gt; &nbsp;" />
                <h:outputText value="#{node.title} &nbsp;" />
            </ui:repeat>
        </h:panelGroup>
        <rich:messages id="messages"
                layout="table" tooltip="true" showDetail="false" showSummary="true"
                styleClass="messages" errorClass="error"
                fatalClass="fatal" infoClass="info" warnClass="warn" />

        <ui:insert name="tab_content" />

        <rich:toolBar height="34" itemSeparator="line">
            <rich:toolBarGroup location="right">
                <a4j:commandButton id="save" value="#{glob.save}"
                    action="#{controller.save}" reRender="messages, nodeTree"
                    disabled="#{controller.selectedNode == null}" />
                <a4j:commandButton id="delete" value="#{glob.delete}" rendered="#{empty canDelete || canDelete}"
                    action="#{controller.delete}" reRender="messages, nodeTree"
                    disabled="#{controller.selectedNode == null}" />
            </rich:toolBarGroup>
        </rich:toolBar>
    </h:panelGrid>
</a4j:form>

And this is the left-hand/tree form:

<a4j:form id="nodeBrowserForm" ajaxSubmit="true">
        <h:panelGrid columns="1">
            <rich:tabPanel switchType="client">
                <rich:tab label="Browse">
                    <h:panelGrid colums="1">
                        <rich:tree id="nodeTree" 
                            nodeSelectListener="#{nodeTreeController.nodeSelected}" 
                            ajaxSubmitSelection="true"  switchType="client" reRender="node_editor, newNode"
                            showConnectingLines="false"
                            adviseNodeOpened="#{nodeTreeController.adviseNodeOpened}"
                            adviseNodeSelected="#{nodeTreeController.adviseNodeSelected}"
                            value="#{nodeTreeController.browserRootNode}" var="item" ajaxKeys="#{null}">
                        </rich:tree>
                    </h:panelGrid>
                </rich:tab>
            </rich:tabPanel>
            <a4j:commandButton id="newNode"
                value="New Node" disabled="#{nodeTreeController.selectedNode == null}" reRender="nodeTree"
                action="#{nodeTreeController.createNode}" />
        </h:panelGrid>
        </a4j:form>

I've tried to clean up some of the markup to make it more straightforward.

A: 

Ok, the problem was simply a typo on my side. The reRendering is now working in both directions.

Steve