Search code examples
jsfrichfacesajax4jsf

richfaces 4 extendeddatatable not showing updated data after ajax render


Environment:

Jboss 7.1.1.Final JSF 2.2.6 Seam 2.3.1.Final Richfaces 4.5.10.Final

Issue

Richfaces 4 extendeddatatable on render does not hold the value (Resource dropdown in the example listed below).

Steps:

  1. First I choose a value from the Resource dropdown
  2. Then I choose a value form the Result dropdown which triggers the a4j:ajax call

My XHTML structure is as listed below:

<a4j:region id="hraregion">
    <rich:extendedDataTable id="hraProcessing"
        value="#{maActionList}" var="mpa" selectionMode="single">

        <h:column width="200px">
            <f:facet name="header">
                <h:outputText value="Resource" />
            </f:facet>
            <h:selectOneMenu id="staffResources" value="{mpa.staffResources}" label="Resource"
                <s:selectItems value="#{mpa.validStaffResources}" var="sr" label="#{sr.firstName} #{sr.lastName}"/>
                <s:convertEntity />
            </h:selectOneMenu>
        </h:column>
        <rich:column width="140px">
            <f:facet name="header">
                <h:outputText value="Result" />
            </f:facet>
            <h:selectOneMenu id="results" value="#{mpa.actionResults}">
                <a4j:ajax execute="region"  listener="#{maintainAssessment.performNextAction(mpa, 'mpa')}" render="hraProcessing, actionMessage" />
                <s:selectItems value="#{mpa.validActionResults}" var="ar" label="#{ar.name}" noSelectionLabel="Select One" />
                <s:convertEntity />
            </h:selectOneMenu>
        </rich:column>
    </rich:extendedDataTable>
</a4j:region>

Note:

We are migrating from Richfaces 3.3 to 4.5 and this functionality was working fine in Richfaces 3.3 but ofcourse the entire page was refreshed in 3.3 as opposed to the partial refresh in Richfaces 4.5

Can someone please point me in the right direction on how to retain the selected value after the a4j render happens?


Solution

  • I found a way to accomplish this by updating the backing bean immediately using f:ajax after the value changes in the Resource dropdown. Hope this helps someone who faces the same issue.

    <h:selectOneMenu id="staffResources" value="#{mpa.staffResources}"
        label="Resource" styleClass="LFloat">
        <s:selectItems value="#{mpa.validStaffResources}" var="sr"
        label="#{sr.firstName} #{sr.lastName}"/>
        <s:convertEntity />
        <f:ajax event="valueChange" execute="@this" render="@none"/>
    </h:selectOneMenu>