so that the records can be selected multiple using checkboxe...">

PRINT PANELS

In my project, I use datatable with <p:column selectionMode="multiple" /> so that the records can be selected multiple using checkboxes.

However, when the user clicks on a row, the entire previous selection is not selected and only that row is selected. This behavior is unexpected and annoying. I would like to disable the behavior of rowSelect and rowUnselect when I press a key, but it looks like I had no way to do anything but hack the datatable.js source.

Has anyone implemented this before? Thanks for answering.

Using:

primary 3.5

mojarra 2.1.6

glassfish 3.1.2.2

+7
source share
2 answers

According to this function , this function is now supported in Primefaces versions 5.0.3 and 5.1 simply by adding rowSelectMode = "checkbox" to the datatable.

Documentation link (PF 5.1):

Use the rowSelectMode parameter to configure the default behavior in a row. Multiple click clicks are enabled. Default value: "new", which clears the previous selections, the "add" mode saves the previous selection, similar to selecting a line with a click of the mouse when metakey is on and "checkbox" allows you to select a line only with the help of flags.

+11
source

Putting this on your page can help stop the selection when you click a line.

 $(document).ready( function() { $("tr td").click(function(event) { if (!$(this).find("div").hasClass("ui-chkbox") || $(this).find("div").find("div").hasClass("ui-state-disabled")) { event.stopPropagation(); } }); }); 
+1
source

All Articles