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.