1 Reply Latest reply on Feb 21, 2011 5:01 AM by ilya_shaikovsky

    rich:extendedDataTable selection and h:selectOneMenu processing order

    tinfailhat

      I'm working on an application that's basically a customised database administration tool.

       

       

      The page structure is basically the following:

       

       

      <a4j:region>

        <h:selectOneMenu value='#{bean.selectedTable}'>

          ...

           <a4j:ajax event='change' render='tablePanel'/>

        </h:selectOneMenu>

         <a4j:outputPanel id='tablePanel'>

           <rich:extendedDataTable id='table' selection='#{bean.selectedRows}' ...>

            <f:facet name='header'>

               [datascroller etc.]

              <a4j:commandButton action='#{bean.deleteSelectedRows}' execute='@region' render='tablePanel'/>

             </f:facet>

             [columns]

           </rich:extendedDataTable>

        </a4j:outputPanel>

      <a4j:region>

       

      The selectOneMenu is used to choose which database table will be displayed. The backing bean is request scoped and set up to pick the first available table as a default when it's initialised. I'm using an ExtendedDataTable subclass to paginate data in the database.

       

      When I click the commandButton to delete the rows, it seems that the extendedDataTable component determines the selected rows /before/ the value of bean.selectedTable is applied. This means that no matter what table is selected in the dropdown menu, RichFaces tells me the selected rows are some (more or less arbitrary) rows in the default database table.

       

      I verified that this is an ordering problem, when deleteSelectedRows() is called the value of selectedTable is correct. I'm using Richfaces 4 M6, and a4j;keepAlive doesn't seem to be there anymore to preserve the bean state.

       

      Is there a way to tell RichFaces / JSF in which order to do these things? I tried using immediate="true" on the h:selectOneMenu but that didn't help.

       

      Also, after a delete, the tablePanel doesn't seem to be rerendered, while another a4j:commandButton that adds new records with the same execute and render attributes seems to work fine. Is there a way to debug the state of RichFaces ajax requests / hook into them via events?