hellzone
hellzone

Reputation: 5246

Primefaces datatable column update

I have a Primefaces datatable and what I want to do is after user clicks to "removeItemsFromList" button, program will update datatable records. Datatable is updating but my checkbox column doesn't. After I click to button, records are updating but selected checkboxes still remains selected. I want them to reset. I mean I want all datatable to reset.Is there any easy way to do this?

My commandbutton;

<p:commandButton value="removeItemsFromList"
                         actionListener="#{myController.sendToArchive()}"
                         update="myDatatableId"
                         icon="ui-icon-folder-open"/>

My datatable column;

<p:column headerText="">
                <p:selectBooleanCheckbox>
                    <p:ajax event="change" listener="#{myController.addToSelectionList(iss)}"/>
                </p:selectBooleanCheckbox>
            </p:column>

Upvotes: 1

Views: 3671

Answers (1)

Emil Kaminski
Emil Kaminski

Reputation: 1885

You can achieve this functionality using the resetInput component:

<p:commandButton value="removeItemsFromList"
                     actionListener="#{myController.sendToArchive()}"
                     update="myDatatableId"
                     icon="ui-icon-folder-open">
    <p:resetInput target="myDatatableId" /> 
</p:commandButton> 

For other solutions i can suggest:

A. Javascript / JQuery

B. Binding the value of the checkbox to a bean variable, and set it to false after each update

Upvotes: 1

Related Questions