I'm working with Primefaces 3.5 Data Table. The table is with multiselection mode enabled. Basically, the table is the same as the last one from [this showcase][1]. So the table is defined like this
<p:dataTable id="myTable" var="item" value="#{myController.items}" selection="#{myController.selectedItems}" rowKey="#{item.id}">
<p:column selectionMode="multiple"/>
<p:column headerText="Id">
...
So when the user selects some rows by clicking on checkboxes and then accidentally clicks on one row, all selected rows become unselected except the one on which user clicked at last.
The question is: Is there any workaround to maintain rows selected even if user will click on the row out of checkbox?
Some of my observations:
- If the user will press Ctrl and click on the row all other rows will maintain selected. This behavior is exactly what I want, but without pressing Ctrl.
- I've looked at
primefaces.js
source and found that other rows are deselected by this functionclearSelection:function(){}
. It would be fine to do not execute it when user will click on row.