2 Replies Latest reply on May 4, 2011 7:13 AM by dandii

    Rendering an ExtendedDataTable after changing an other one

    dandii

      Hi community,

       

      I have a xhtml page with two rich:extendedDataTables. After selection of the first one I load some entities into the second one.

      My idea is that the second table just appears if there are some etities to display (Those entities are related to the selection in the first table).

       

      The problem is that I must refresh the browser for correct disply of the second table. Do anyone know a solution for this?

       

      regards Andi

       

      <h:form>
      <div><a4j:region id="region">
      
           <rich:extendedDataTable
                id="firstTable"
                value="#{firstList.all}" 
                var="first"
                selection="#{firstSelectionBean.selection}"
                rendered="#{not empty firstList.all}"
                selectionMode="single" >
      
                <a4j:ajax execute="@form" event="selectionchange"
                     listener="#{firstSelectionBean.selectionListener}"
                     render="runTable" />
      
                <rich:column>...</rich:column>
                <rich:column>...</rich:column>
                <rich:column>...</rich:column>
           </rich:extendedDataTable>
      
      </a4j:region></div>
      
      <div style="margin-top: 10px;"><a4j:region id="runTableRegion">
      
           <rich:extendedDataTable
                id="secondTable"
                value="#{secondList.getItems(firstController.item)}"
                rendered="#{not empty secondList.getItems(firstController.item)}"
                var="second"
                selection="#{secondSelectionBean.selection}"
                selectionMode="single">
      
                <rich:column>...</rich:column>
                <rich:column>...</rich:column>
                <rich:column>...</rich:column>
           </rich:extendedDataTable>
      
      </a4j:region></div>
      </h:form>
      
        • 1. Rendering an ExtendedDataTable after changing an other one
          ilya_shaikovsky

          That should works:

           

          <h:form>
          <div><a4j:region id="region">

               <rich:extendedDataTable
                    id="firstTable"
                    value="#{firstList.all}"
                    var="first"
                    selection="#{firstSelectionBean.selection}"
                    rendered="#{not empty firstList.all}"
                    selectionMode="single" >


                    <a4j:ajax execute="@form" event="selectionchange"
                         listener="#{firstSelectionBean.selectionListener}"
                         render="tableToUpdate" />

                    <rich:column>...</rich:column>
                    <rich:column>...</rich:column>
                    <rich:column>...</rich:column>
               </rich:extendedDataTable>

          </a4j:region></div>

          <div style="margin-top: 10px;"><a4j:region id="runTableRegion">
          <a4j:outputPanel layout="block" id="tableToUpdate">
               <rich:extendedDataTable
                    id="secondTable"
                    value="#{secondList.getItems(firstController.item)}"
                    rendered="#{not empty secondList.getItems(firstController.item)}"
                    var="second"
                    selection="#{secondSelectionBean.selection}"
                    selectionMode="single">


                    <rich:column>...</rich:column>
                    <rich:column>...</rich:column>
                    <rich:column>...</rich:column>
               </rich:extendedDataTable>
          </a4j:outputPanel>
          </a4j:region></div>
          </h:form>

          • 2. Rendering an ExtendedDataTable after changing an other one
            dandii

            Hi Ilya,

             

            that's it... Thanks a lot!