1

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>
4

1 回答 1

1

您可以使用 resetInput 组件实现此功能:

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

对于其他解决方案,我可以建议:

A. Javascript/JQuery

B.将checkbox的值绑定到一个bean变量上,每次更新后设置为false

于 2013-07-22T12:24:50.900 回答