Refresh Datatable - Ajax cellEdit (Primefaces)

1

Hello, I'm trying to update the DataTable but I'm not getting it. Here is the code:

<h:form id="testeForm" >
 <p:panel toggleable="true" id="panelTeste">                
    <h:panelGrid columns="1" cellpadding="1" id="panelGridTeste">

       <p:dataTable  id="dataTableTeste" var="teste" value="#{testeController.listaTeste" editable="true" editMode="cell" >

          <p:ajax event="cellEdit" listener="#{testeController.atualizarDataTable}"  update=":testeForm:dataTableTeste"/>

          <p:columnGroup type="header">
             <p:row>
                <p:column headerText="Col1" />
                <p:column headerText="Col2" />
                <p:column headerText="Col3" />
             </p:row>
          </p:columnGroup>

          <p:column>
             <p:cellEditor>
                <f:facet name="output"><h:outputText value="#{teste.valorCol1}" /></f:facet>
                <f:facet name="input"><p:inputText value="#{teste.valorCol1}" /></f:facet>
             </p:cellEditor>
          </p:column>

          <p:column>
             <p:cellEditor>
                <f:facet name="output"><h:outputText value="#{teste.valorCol2}" /></f:facet>
                <f:facet name="input"><p:inputText value="#{teste.valorCol2}" /></f:facet>
             </p:cellEditor>
          </p:column>

          <p:column>
             <h:outputText value="#{teste.valorCol3}" />
          </p:column>
       </p:dataTable>
    </h:panelGrid>
 </p:panel>
</h:form>

testController:

public void atualizarDataTable(CellEditEvent event) {           
    for (Teste teste : listaTeste) {
       valorCol3 = valorCol1 + valorCol2;
    }
}

Everything works correctly, I just can not update the DataTable information.

Does anyone know how I can do this?

I've also tried p:remoteCommand and it works if after I edit the cell press enter but it does not work if you exit the field with tab (which is which I need).

I'm trying to update on the Controller / Bean with RequestContext.getCurrentInstance().update("testeForm:dataTableTeste"); and it's not working either ... It does not update.

Thank you

    
asked by anonymous 19.01.2016 / 20:22

0 answers