7 Replies Latest reply on Feb 3, 2012 7:48 PM by phelen harg

    rich:dataTable

    phelen harg Newbie

      How to edit a dataTable with 2 clicks? I must to redirect to the another page, but with a4j I can not do it.

        • 1. Re: rich:dataTable
          Mahesh Bonagiri Newbie

          use <a4j:support event="

          onRowDblClick" action="#{M.B.action}" />

          • 2. Re: rich:dataTable
            phelen harg Newbie

            I can't forward with a4j. I tried

                      public String edit() {

             

                                return "editPage";

                      }

             

            I have editPage on faces config, if i use a h:commandButton it works fine, but with a a4j event it does'nt work. There's a solution to it?

            • 3. Re: rich:dataTable
              phelen harg Newbie

              i'm using jsf 2.0 richfaces 4.1

              • 4. Re: rich:dataTable
                Mahesh Bonagiri Newbie

                r u using <h:form> tag or <a4j:form>?

                can you please paste ur code, so that i can look into it

                • 5. Re: rich:dataTable
                  phelen harg Newbie

                  i'm using <h:form> because i can't use a4j:form with jsf 2 and Richfaces 4.

                   

                   

                  <ui:composition template="/main.xhtml"> 
                            <ui:define name="conteudo">
                                      <h:form id="form"> 
                                                          <center>
                                                                    <rich:dataTable var="record" id="tabelaEmpls"
                                                                              value="#{listEmplBean.dataModel}" width="100%" 
                                                                              render="form" styleClass="tabela" sortMode="single">
                                                                              <a4j:ajax event="rowdblclick" action="#{listEmplBean.editar}" execute="@all" />
                    
                                                                              <f:facet name="header">
                                                                                        <h:outputText value="Listagem de Empls" />
                                                                              </f:facet>
                    
                                                                              <rich:column width="10px">
                                                                                        <h:selectBooleanCheckbox value="#{record.selecionado}" />
                                                                                        <f:facet name="header"/>
                                                                              </rich:column>
                    
                                                                              <ui:include src="/includes/jpaColumn.xhtml">
                                                                <ui:param name="bean" value="#{listEmplBean}" />
                                                                <ui:param name="propriedade" value="nome" />
                                                                <ui:param name="coluna" value="Nome" />
                                                            </ui:include> 
                    
                                                                              <f:facet name="footer">
                                                                                        <h:outputText
                                                                                                  value="Resultados encontrados: #{listEmplBean.total} Exibindo #{listEmplBean.paginaAtual + 1} até #{listEmplBean.paginaAtual + listEmplBean.maxPorPagina}" />
                                                                              </f:facet>
                                                                    </rich:dataTable>
                                                          </center> 
                                                <rich:panel>
                                                                    <br />
                                                                    <h:panelGroup rendered="#{listEmplBean.modoLista=='listgem'}">
                                                                              <div align="center"><h:commandButton value="Incluir"
                                                                                        action="#{listEmplBean.incluir}" styleClass="botao-b" /> 
                    
                                                                              <h:commandButton value="Excluir"
                                                                                        onclick="return confirmaExclusao();"
                                                                                        action="#{listEmplBean.excluir}" styleClass="botao-b"/></div>
                                                                    </h:panelGroup>
                    
                                                </rich:panel>
                                      </h:form>
                            </ui:define>
                  </ui:composition>
                  
                  
                  • 6. Re: rich:dataTable
                    phelen harg Newbie

                    I tried to do it with an h:commandButton called by the a4j, but it is an ugly solution.

                    • 7. Re: rich:dataTable
                      phelen harg Newbie

                      Temporary solution:

                       

                      I put a hiden button in my table template:

                      <h:commandButton value="select" action="#{listaEmplBean.editar}" styleClass="editBtn" style="display:none"/>

                       

                      and a jQuery solution to dblClick

                       

                      <rich:jQuery selector=".tabela tbody tr" event="dblclick" query="jQuery(this).find('.editBtn')[0].click()"/>

                       

                       

                      There is a more elegant solution?