javascript - Do not unselect rows when clicking on another rows in Primefaces datatable -
i'm working primefaces 3.5 data table. table multiselection mode enabled. basically, table same last 1 this showcase. table defined 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 user selects rows clicking on checkboxes , accidentally clicks on 1 row, selected rows become unselected except 1 on user clicked @ last.
the question is: there workaround maintain rows selected if user click on row out of checkbox?
some of observations:
- if user press ctrl , click on row other rows maintain selected. behavior want, without pressing ctrl.
- i've looked @
primefaces.js
source , found other rows deselected functionclearselection:function(){}
. fine not execute when user click on row.
edit:
as kukeltje suggested, i've created primefaces.js
patch modified datatable
widget. so, i've copied primefaces.js
jar file, performed modifications , put under following directory:
webapp |-- meta-inf |-- web-inf |-- resources | |-- primefaces | | `-- primefaces.js
the modification i've done in primefaces.js
removing this.unselectallrows()
onrowclick: function(e, d, a)
function.
if read more recent documentation, can see supported in newer releases. fix 3.5, @ source of newer releases on how 'fixed' , create js patch… can ofcourse try use newer pf version. lots of advantages when doing latter.
the reason not posting (or trying create) patch here (or trying create one) is waaaaay complex post here , imo beyond scope of so
Comments
Post a Comment