1 Reply Latest reply on Jul 24, 2007 8:58 PM by ccsilva

    dataTable - onRowClick (help please)

    ccsilva

      Hi,

      I am trying to work with the event onRowClick of a dataTable.

      I already have read the posts below and others.

      http://jboss.com/index.html?module=bb&op=viewtopic&t=111455http://jboss.com/index.html?module=bb&op=viewtopic&t=106284http://jboss.com/index.html?module=bb&op=viewtopic&t=107198

      But, by some reason my onRowClick event is not working. Please see the code below:

      Datatable relevant code:

       <a4j:form ajaxSubmit="true" >
       <a4j:outputPanel ajaxRendered="true" id="teste">
       <rich:dataTable
       id="dtTarefasEntrada"
       columnClasses="col"
       value="#{workflowBean.tarefasEntrada}"
       var="tarefa"
       binding="#{workflowBean.tabela}"
       >
      
       <a4j:support event="onRowClick" actionListener="#{workflowBean.rowSelected}"/>
      
       <f:facet name="header">
       <rich:columnGroup>
       <rich:column>
       <h:outputText styleClass="headerText" value="ID" />
       </rich:column>
       <rich:column>
       <h:outputText styleClass="headerText" value="Observacao" />
       </rich:column>
       <rich:column>
       <h:outputText styleClass="headerText" value="links" />
       </rich:column>
       </rich:columnGroup>
       </f:facet>
      
       <rich:column>
       <h:outputText value="#{tarefa.id}" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{tarefa.dadosTarefa.observacao}" />
       </rich:column>
       <rich:column>
       <a4j:commandLink value="[detalhes]" action="#{workflowBean.rowSelected2}" reRender="teste, detalhes"></a4j:commandLink>
       </rich:column>
      
       </rich:dataTable>
       </a4j:outputPanel>
       </a4j:form>
      


      Backing bean methods:

       public void rowSelected(ActionEvent event) {
       System.out.println("rowSelected");
       Integer currIndex = getTabela().getRowIndex();
       List allData = (List) getTabela().getValue();
      
       this.tarefa = (Tarefa) allData.get(currIndex);
       System.out.println("@#@#@#@#@#@#@: ROW: "+ tarefa.getId()+" "+tarefa.getDadosTarefa().getObservacao());
       }
      
       public void rowSelected2() {
       System.out.println("rowSelected");
       Integer currIndex = getTabela().getRowIndex();
       List allData = (List) getTabela().getValue();
       Tarefa t = (Tarefa)getTabela().getRowData();
       System.out.println("T: "+ t.getId());
      
       this.tarefa = (Tarefa) allData.get(currIndex);
       System.out.println("@#@#@#@#@#@#@: ROW: "+ tarefa.getId()+" "+tarefa.getDadosTarefa().getObservacao());
       }
      


      Tarefa and DadosTarefa are POJOs.

      NOTE: If I click on link generated by my commandLink, all works fine with method: "rowSelected2()". But If I click on a row the method "rowSelected(ActionEvent event)" is never called.

      I already have put a <a4j:log/> and I saw that when I click on a row there are no events generated.

      Please, help!!!

      Thanks a lot!!!

      Claudiney

      (Brazil)