1 Reply Latest reply on Jun 20, 2012 6:37 AM by Joaquín Carrasco

    Problems with rich:tabpanel and selections in extendeddatatables inside of it

    Joaquín Carrasco Newbie

      Hi, I have a problem when I use extendeddatatables inside different tabs in  rich:tabpanel. The first time the page is loaded the selections work properly in the different extendeddatatables I have in the differents tabs. But when I click again in a previous tab that I have clicked on before, the selections in all tables stop working. If I a refresh the page all works again the first time but the succesive times the selections broke again, an so on. I´m using Richfaces 4.2.0. Anyone could help me please? What is wrong? Thanks in Advance. Here is some code:

       

      <rich:tabPanel switchType="ajax">

                      <rich:tab header="Empleados" switchType="ajax">

                          <h:panelGrid columns="2" id="prueba">

       

                              <rich:panel header="Consulta de Cuadrillas" id="paneCuadrillas">

                                  <rich:extendedDataTable value="#{exttablecuad.cuadrillasItems}"

                                      var="cuadrillas" id="tablecuadrillas" frozenColumns="3"

                                      iterationStatusVar="itCuadrillas"

                                      style="height:300px; width:300px;"

                                      selection="#{exttablecuad.selection}" selectionMode="single">

                                      <a4j:ajax execute="@form" event="selectionchange"

                                          listener="#{exttablecuad.selectionListener}"

                                          render="tableEmpleados" />

                                      <f:facet name="header">

                                          <h:outputText value="Cuadrillas" />

                                      </f:facet>

       

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Codigo Cuadrilla" />

                                          </f:facet>

                                          <h:outputText value="#{cuadrillas.id}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Encargado" />

                                          </f:facet>

                                          <h:outputText value="#{cuadrillas.nombreEncargado}" />

                                      </rich:column>

                                      <rich:column>

                                          <a4j:commandLink styleClass="no-decor" execute="@this"

                                              render="@none"

                                              oncomplete="#{rich:component('confirmPaneCuadrillas')}.show()">

                                              <h:graphicImage value="/images/icons/delete.gif" alt="delete" />

                                              <a4j:param value="#{itCuadrillas.index}"

                                                  assignTo="#{cuadrillasBean.currentCuadIndex}" />

                                          </a4j:commandLink>

                                          <a4j:commandLink styleClass="no-decor"

                                              render="editCuadrillasGrid" execute="@this"

                                              oncomplete="#{rich:component('cuadrillaspopup')}.show()">

                                              <h:graphicImage value="/images/icons/edit.gif" alt="edit" />

                                              <a4j:param value="#{itCuadrillas.index}"

                                                  assignTo="#{cuadrillasBean.currentCuadIndex}" />

                                          </a4j:commandLink>

                                      </rich:column>

                                  </rich:extendedDataTable>

                              </rich:panel>

       

                              <rich:panel header="Consulta de Empleados" id="paneEmpleados">

                                  <rich:extendedDataTable value="#{exttablecuad.empleadosItems}"

                                      var="empleados" id="tableEmpleados" frozenColumns="7"

                                      iterationStatusVar="itEmp" style="height:300px; width:600px;"

                                      selectionMode="none" rendered="true">

                                      <f:facet name="header">

                                          <h:outputText value="Empleados" />

                                      </f:facet>

       

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="DNI" />

                                          </f:facet>

                                          <h:outputText value="#{empleados.dni}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Apellidos" />

                                          </f:facet>

                                          <h:outputText value="#{empleados.apellidos}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Nombre" />

                                          </f:facet>

                                          <h:outputText value="#{empleados.nombre}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Tipo" />

                                          </f:facet>

                                          <h:outputText value="#{empleados.tipoEmpleado}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Códido Cuadrilla" />

                                          </f:facet>

                                          <h:outputText value="#{empleados.codCuadrilla}" />

                                      </rich:column>

                                      <rich:column>

                                          <a4j:commandLink styleClass="no-decor" execute="@this"

                                              render="@none"

                                              oncomplete="#{rich:component('confirmPaneEmpleados')}.show()">

                                              <h:graphicImage value="/images/icons/delete.gif" alt="delete" />

                                              <a4j:param value="#{itEmp.index}"

                                                  assignTo="#{empleadosBean.currentEmpleadoIndex}" />

                                          </a4j:commandLink>

                                          <a4j:commandLink styleClass="no-decor"

                                              render="editEmpleadosGrid" execute="@this"

                                              oncomplete="#{rich:component('empleadospopup')}.show()">

                                              <h:graphicImage value="/images/icons/edit.gif" alt="edit" />

                                              <a4j:param value="#{itEmp.index}"

                                                  assignTo="#{empleadosBean.currentEmpleadoIndex}" />

                                          </a4j:commandLink>

                                      </rich:column>

                                  </rich:extendedDataTable>

                              </rich:panel>

       

                          </h:panelGrid>

                      </rich:tab>

                      <rich:tab header="Fincas" switchType="ajax">

                          <h:panelGrid columns="2">

       

                              <rich:panel header="Consulta de Parcelas" id="paneParcela">

                                  <rich:extendedDataTable value="#{exttablepar.parcelasItems}"

                                      var="parcelas" id="tableparcelas" frozenColumns="3"

                                      iterationStatusVar="itParcelas"

                                      style="height:300px; width:300px;"

                                      selection="#{exttablepar.selection}" selectionMode="single">

                                      <a4j:ajax execute="@form" event="selectionchange"

                                          listener="#{exttablepar.selectionListener}"

                                          render="tableFincas" />

                                      <f:facet name="header">

                                          <h:outputText value="Parcelas" />

                                      </f:facet>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Codigo Parcela" />

                                          </f:facet>

                                          <h:outputText value="#{parcelas.codParcela}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Codigo Finca" />

                                          </f:facet>

                                          <h:outputText value="#{parcelas.codFinca}" />

                                      </rich:column>

                                      <rich:column>

                                          <a4j:commandLink styleClass="no-decor" execute="@this"

                                              render="@none"

                                              oncomplete="#{rich:component('confirmPaneParcelas')}.show()">

                                              <h:graphicImage value="/images/icons/delete.gif" alt="delete" />

                                              <a4j:param value="#{itParcelas.index}"

                                                  assignTo="#{parcelasBean.currentParIndex}" />

                                          </a4j:commandLink>

                                          <a4j:commandLink styleClass="no-decor"

                                              render="editParcelasGrid" execute="@this"

                                              oncomplete="#{rich:component('parcelaspopup')}.show()">

                                              <h:graphicImage value="/images/icons/edit.gif" alt="edit" />

                                              <a4j:param value="#{itCuadrillas.index}"

                                                  assignTo="#{parcelasBean.currentParIndex}" />

                                          </a4j:commandLink>

                                      </rich:column>

                                  </rich:extendedDataTable>

                              </rich:panel>

       

                              <rich:panel header="Consulta de Fincas" id="paneFincas">

                                  <rich:extendedDataTable value="#{exttablepar.fincasItems}"

                                      var="fincas" id="tableFincas" frozenColumns="3"

                                      iterationStatusVar="itFincas" style="height:300px; width:500px;"

                                      selectionMode="none" rendered="true">

                                      <f:facet name="header">

                                          <h:outputText value="Fincas" />

                                      </f:facet>

       

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Codigo Finca" />

                                          </f:facet>

                                          <h:outputText value="#{fincas.codFinca}" />

                                      </rich:column>

                                      <rich:column>

                                          <f:facet name="header">

                                              <h:outputText value="Nombre" />

                                          </f:facet>

                                          <h:outputText value="#{fincas.nombre}" />

                                      </rich:column>

                                      <rich:column>

                                          <a4j:commandLink styleClass="no-decor" execute="@this"

                                              render="@none"

                                              oncomplete="#{rich:component('confirmPaneFincas')}.show()">

                                              <h:graphicImage value="/images/icons/delete.gif" alt="delete" />

                                              <a4j:param value="#{itFincas.index}"

                                                  assignTo="#{fincasBean.currentFincaIndex}" />

                                          </a4j:commandLink>

                                          <a4j:commandLink styleClass="no-decor" render="editFincasGrid"

                                              execute="@this"

                                              oncomplete="#{rich:component('fincaspopup')}.show()">

                                              <h:graphicImage value="/images/icons/edit.gif" alt="edit" />

                                              <a4j:param value="#{itFincas.index}"

                                                  assignTo="#{fincasBean.currentFincaIndex}" />

                                          </a4j:commandLink>

                                      </rich:column>

                                  </rich:extendedDataTable>

                              </rich:panel>

       

                          </h:panelGrid>

                      </rich:tab>

       

                  </rich:tabPanel>