jsf - Refresh selection model of p:datatable on row deselection -


i have problem selection model of primefaces 5.0 datatable. selection model not process deselection properly: selection of rows adds these roles expected list of selected rows. deselection has no influence on list; deselected rows remains in it. deselecting rows produces empty list.

the following gives definition of datatable (reduced relevant tags) - data model of type org.primefaces.model.lazydatamodel:

<p:datatable id="cases"      widgetvar="cases"     var="cases"     value="#{casescontroller.datamodel}"     selection="#{casescontroller.selectedcases}"     selectionmode="multiple"     /> 

there javascript function used in project processes clicks on rows select , deselect rows.

onrowclick : function(event, rowelement, silent) {     // check if rowclick triggered event not clickable     // element in row content     if ($(event.target).is('td,span:not(.ui-c)')) {         var row = $(rowelement),             selected = row.hasclass('ui-state-highlight'),             metakey = event.metakey || event.ctrlkey,             shiftkey = event.shiftkey;             mousebtn = event.which;          // unselect if selected on leftclick/touch enable         // contextmenu shown on rightclick         if (selected && mousebtn == 1) {             this.originrowindex = row.index();             this.cursorindex = null;             this.unselectrow(row, silent);         } else {             // unselect previous selection if single             // selection or multiple 1 no keys             if (this.issingleselection()                     || (this.ismultipleselection() && event                             && !metakey && !shiftkey && this.cfg.rowselectmode === 'new')) {                 this.unselectallrows();             }              // range selection shift key             if (this.ismultipleselection() && event && event.shiftkey) {                 this.selectrowsinrange(row);             }             // select current row             else {                 this.originrowindex = row.index();                 this.cursorindex = null;                 this.selectrow(row, silent);             }         }         primefaces.clearselection();     } } 

debugging script shows branches passed expected. seems me, unselectrow() not opposite of selectrow().

adding comment around javascript function use original primefaces function has no effect on problem.

i found solution. had extended primefaces implemenation , incompletely implemented methods. following thread helped me in solving problem: p:datatable selections lost after paginating lazydatamodel


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -