0 Replies Latest reply on Mar 20, 2012 3:49 PM by Ivan Costa

    Problem with rich:dataTable row delete - ajax

    Ivan Costa Newbie

      Hi,

       

      I'm migrating from RF 3.3.3 to RF 4.2. Now rich:dataTable (binded to list of entities) inside ui:fragment aren´t working properly.

       

      THE PROBLEM:

           commandLink to remove row from rich:dataTable via ajax is always getting no row available, even when there are plenty of them!

       

           if (tabelaProprietarios.isRowAvailable()) {

                  PessoaVO vo = (PessoaVO)tabelaProprietarios.getRowData();

                  listaProprietarios.remove(vo);

       

       

      But, if changed from rich:dataTable to h:dataTable

           and in binding, from org.richfaces.component.UIDataTable to HtmlDataTable

      the commandLink deletes the row and updates the datatable nicely!

       

      What am I doing wrong? Am I missing something?

       

      Thanks in advance

      Ivan

       

       

      =============================================

      CODE:

       

      Managed bean is @ViewScoped, Mojarra 2.1.7, Tomcat 7.0.26

       

      datatable is binded to:

            private transient org.richfaces.component.UIDataTable tabelaProprietarios;

       

      <ui:include src="/template/selecionaPessoa.xhtml">

                              <ui:param name="listaDePessoas" value="#{propriedadeRural.proprietarios}"/>

                              <ui:param name="idDaTabela" value="tabelaProprietario" />

                              <ui:param name="tabelaBinding" value="#{propriedadeRural.tabelaProprietarios}" />

                              <ui:param name="nomeDoBean" value="#{propriedadeRural}" />

                              <ui:param name="actionRemove" value="removeProprietario" />

      </ui:include>

       

       

      /template/selecionaPessoa.xhtml

      <ui:fragment>

                     <table>

                              <tr>

                                  <td class="primeiraColuna">

                                  </td>

                                  <td width="60%">

                                 

                                      <div>

                                          <a4j:region>

                                              <h:panelGroup id="idPanelGroupSelecionaPessoa">                               

                                                  <rich:dataTable id="#{idDaTabela}"

                                                      value="#{listaDePessoas}"

                                                      binding="#{tabelaBinding}"

                                                      style="width: 90%;"

                                                      var="item" >

                                                     

                                                      <rich:column style="width: 10%">

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

                                                      </rich:column>

                                                      

                                                      <rich:column style="width: 80%">

                                                             

                                                          <h:commandLink value="#{item.nome}" action="#{buscaPessoa.editar}"  >

                                                              <f:param name="idPessoaEscolhida" value="#{item.id}" >

                                                              </f:param>

                                                              <f:param name="tipoPessoaEscolhida" value="#{item.tpPessoa}">

                                                              </f:param>

                                                          </h:commandLink>

                                                              

                                                      </rich:column>

                                                      

                                                      <rich:column>

       

                                                           <h:commandLink value="Remover">

                                                              <f:ajax listener="#{nomeDoBean[actionRemove]}"

                                                                  render="@form" >

                                                              </f:ajax>

                                                          </h:commandLink>

        

                                                      </rich:column>

                                                      

                                                  </rich:dataTable>

                                              </h:panelGroup>

                                          </a4j:region>

                                      </div>                   

       

                                  </td>   

                              </tr>

                          </table>

      <ui:fragment>