Reputation: 183
I use primefaces 3.0.1 and I have a problem with my datatable.
I use my datatable with the instant row selection. That works very well. But I wish use in the same time the checkbox selection (for exemple, for select some rows and delete the selected rows)
And when I use the
<p:column selectionMode="multiple" />
the checkbox are display, but I can't check any checkbox....
Anyone have a solution ?
Thanks.
P.S. : my code
<p:dataTable id="rows" var="row" value="#{myBean.row}" selection="#{myBean.selectedRow}" selectionMode="single">
<p:ajax event="rowSelect" listener="#{myBean.onRowSelect}" update="@form"/>
<p:column selectionMode="multiple" style="width:18px" />
<p:column>
<h:outputText value="#{row.subject}" />
</p:column>
</p:dataTable>
Upvotes: 1
Views: 3199
Reputation: 1108632
Checkboxes are to be used for multiple row selection, but you've still declared your <p:dataTable>
for single row selection. Remove selectionMode="single"
from the <p:dataTable>
and make sure that the #{myBean.selectedRow}
is changed to be an array instead.
E.g.
<p:dataTable ... selection="#{myBean.selectedRows}">
with
private Row[] selectedRows;
Upvotes: 1