1 Reply Latest reply on Nov 14, 2011 5:57 AM by Sverker Abrahamsson

    RF4: Render occurs before ajax action or parameter update

    Sverker Abrahamsson Novice


      I have a problem in RF4 that the components I specifiy in render are run before the ajax event occurs. For example, I have a rich:select like this:

      <rich:select value="#{taxiManager.selectedCompany}" converter="entityConverter" defaultLabel="#{messages.noSelectionLabel}">
            <f:selectItems value="#{taxiCompanyList}" var="t" itemValue="#{t}" itemLabel="#{t.name}" itemLabelEscaped="true"/>
            <a4j:ajax event="selectitem" execute="@this" render="taxiTable"/>


      The target, taxiTable is a rich:datatable like this:

      <rich:dataTable id="taxiTable" var="taxi" value="#{taxiManager.taxiCollection}">


      The intention is that when a value is selected in rich:select it should be set to the model by ajax call, then the taxiTable is re-rendered to reflect the new data. However, what I see is that taxiManager.getTaxiCollection() is called before taxiManager.setSelectedCompany(), hence the taxiTable is rendered with old data and not the new. This happens also in other scenarios, not only with rich:select, that the render happens before the ajax call has been done instead of after which would be expected.


      I've made a workaround now like this:

      <a4j:jsFunction name="renderTaxiTable" render="taxiTable" />


      which I call from onbeforedomupdate which works but I can see that taxiTable is rendered twice as it calls taxiManager.getTaxiCollection() twice.


      How can this issue be solved so that render happens after the ajax call?