In my project, I use datatable with <p:column selectionMode="multiple" />
so that the entries can be multiple selected using the checkboxes.
However, when the user click on a row, all previous selection is unselected and only that row is selected. This behaviour is unexpected and annoying. I would like to disable the behaviour of rowSelect and rowUnselect on row clicking, but seems I had no way to do but hacking the source of datatable.js.
Does anyone implement this before? Thanks for answering.
Using:
primefaces 3.5
mojarra 2.1.6
glassfish 3.1.2.2
According to this feature request, this feature is now supported in Primefaces versions 5.0.3 & 5.1 by simply adding rowSelectMode="checkbox" to the datatable.
Documentation reference (PF 5.1):
Use rowSelectMode option to customize the default behavior on row click of a multiple selection enabled datatable. Default value is "new" that clears previous selections, "add" mode keeps previous selections same as selecting a row with mouse click when metakey is on and "checkbox" mode allows row selection with checkboxes only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With