javax.faces.ViewState is missing after ajax render

Tommy picture Tommy · Oct 20, 2011 · Viewed 8.2k times · Source

This is not a duplicate post, i just done research but not helping.

First, this is my page... simplified for easy reading.

            <h:form id="treeForm">
                <f:event type="preRenderView" listener="#{taskTreeBean.update}" />              
                <rich:tree id="tree" nodeType="#{node.type}" var="node"
                    value="#{taskTreeBean.rootNodes}" toggleType="client"
                    selectionType="ajax"
                    render="@all"
                    selectionChangeListener="#{taskTreeBean.selectionChanged}">
                    <rich:treeNode>
                    ...
                    </rich:treeNode>
                </rich:tree>
            </h:form>
            <h:form id="taskListTableForm">
                <rich:dataTable id="taskListTable" styleClass="tasklist" keepSaved="true" value="#{taskListModel}" var="task"
                    rowClasses="odd-row, even-row" rows="3">
                    <rich:column>
                    ...
                    </rich:column>
                    <f:facet name="footer">
                        <rich:dataScroller id="scroller" for="taskListTable" />
                    </f:facet>
                </rich:dataTable>
            </h:form>

When i click some tree node, task list form will render, but the viewstate will disappear, which makes dataScroller requires two clicks to next/prev page since the first click is getting back the ViewState value.

I checked the JIRA here - http://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-790.

Tried render="@all" or render="treeForm, taskListTableForm", both failed. I cannot wait mojarra to release 2.2. So is there any workaround here?

Thanks so much. The JIRA is just too difficult to understand.

Edited: There is another problem, the page go from 1 to 2 in the dataTable if i click the tree node. Why?

Answer

Misa picture Misa · Jun 22, 2012

I am aware that you probably solved this problem, but for future reference, this should provide others with the solution.