0
votes

I am using primefaces 5.2. I use a global filter. Each row also has a column for selecting actions. When filtering is on, and the user filters couple rows, I have noticed that, when I click a button, on that row, the returned row is not the same row as selected row. Selected row corresponds to the row before the unfiltered state. Primefaces/JSF assigns an id to each row as such "datatable:row_number:element". The row_number is updated as the filtering goes on but when I invoke an action on the filtered row, the row selected row_number is the row before selection. See below for code sample

 <p:dataTable value="#{workerRotationPage.callbackList}"
              filteredValue="#{workerRotationPage.filteredList}"
              var="callback"
              widgetVar="callbackTable"
              styleClass="custom-datatable waitingCall"
              paginator="true"
              paginatorPosition="top"
              paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
              rowsPerPageTemplate="10,20,50"
              selection="#{workerRotationPage.callbackWorker}"
              selectionMode="single"
              rowKey="#{callback.id}"
              rows="10">
....
 <p:commandButton 
  icon="fa fa-undo"
  value="Unassign"
  action="#{workerRotationPage.execute('unassignCallbackWorker',callback)}"
  title="Unassign Worker #{callback.worker.person.formattedFirstLastName}"
  update=":mainForm:rotationTableId :mainForm:naworkerTableId :mainForm:assignPanelId"
 />

The object passed to execute is not the correct callback object, rather it still refers to the callback object in the same position in the old unfiltered list.

1
did you try without the filteredValue? - Kukeltje
It works without the filteredValue. However since there are too many entries in the table, it is easier for users to filter then click on the action. - work monitored

1 Answers

0
votes

It looks like this is a bug. There seems to be no explanation, or no reason and I have seen it reported many times without any solution. I do not have time to research it on my end but I will give the link for anyone interested Bug Report