-3

Sorry for my english. I use DataTable selection and I want to use DataTable selection with ajax:

<h:form id="form">
    <p:dataTable id="testTableId" var="testTable" value="#{testMB.entityList}"
                 selection="#{testMB.selectedList}" rowKey="#{testTable.id}"
                 tableStyleClass="table table-hover table-bordered">

        <p:column selectionMode="multiple" style="width:16px;text-align:center"/>
        <p:column headerText="testName">
            #{testTable.name}
        </p:column>
        <f:facet name="footer">
            <p:commandButton process="testTableId" action="#{testMB.deleteSelected}" value="It is working"/>

            <p:commandButton process="testTableId" action="#{testMB.deleteSelected}" value="It is not working">
                <p:ajax update="@form" />
            </p:commandButton>              
        </f:facet>
    </p:dataTable>
</h:form>

If I click to button It is working then it is working. But if I click to ajax button It is not working then it is not working.

How can I use it with ajax?

zerg
  • 255
  • 1
  • 3
  • 17
  • With PrimeFaces `p:commandButton`, AJAX is enabled by default. Your second button is equivalent to ` – DavidS Apr 28 '15 at 19:19
  • If I use as `` it is not working as ajax. It is working as without `update="@form"`. – zerg Apr 28 '15 at 19:50
  • Again, and to emphasize: Primefaces' `commandButton` uses [AJAX by default](http://www.primefaces.org/showcase/ui/button/commandButton.xhtml). Your "It is working" button is already using AJAX. Also, why have you specified `process`? Do you know [how it works](https://stackoverflow.com/questions/25339056/understanding-process-and-update-attributes-of-primefaces)? – DavidS Apr 28 '15 at 20:07
  • @DavidS Thank you very much. I used `h:commandButton` instead of `p:commandButton` in my project. – zerg Apr 29 '15 at 05:39

1 Answers1

0

Please go back to the PrimeFaces showcase and learn about the PrimeFaces dataTable and ajax selection. Nowhere in the showcase can examples like you do be found in combination with ajax selection.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • Thank you. I used `h:commandButton` instead of `p:commandButton` in my project. It is my problem. – zerg Apr 29 '15 at 05:39
  • ??? Then your question is totally out sync with what you actually mean. With an `h:commandButton` there is no ajax at all. I'm going to flag the question and my answer to be removed due to a total lack of clearity – Kukeltje Apr 29 '15 at 06:48