Problem is like this:
Suppose there are records in dataTable with FruitType as A (meaning Apple) and O (meaning Orange). When the page is rendered, Records are filtered for Apple. When user filters on Orange and picks 10th record for editing in rowEdit mode, rowEdit listener is invoked on committing the changes. In rowEdit listener, rowEditEvent.getObject() is giving the 10th record of Apple Type.
My Code is attached below ….
<p:dataTable value="#{beanDetails.list_FruitDetails}" rowEditListener="#{beanDetails.handleRowEdit}" var="dataItem">
<p:column filterBy="#{dataItem.FRUITTYPE}" filterOptions="#{beanDetails.options}" filterMatchMode="exact">
<f:facet name="header">
<h:outputLabel value="Fruit Type" />
</f:facet>
<h:outputLabel id="fruitType" value="#{dataItem.FRUITTYPE}" />
</p:column>
</p:dataTable>
@ManagedBean(name="beanDetails")
@ViewScoped
public class Fruits implements Serializable{
public Fruits () throws Exception {
private SelectItem[] options;
options = new SelectItem[2];
options[0] = new SelectItem("A", "Apple");
options[1] = new SelectItem("O", "Orange");
}
public List<FruitDetails> list_FruitDetails;
public void handleRowEdit(RowEditEvent re) throws ParseException {
FruitDetails pd = (FruitDetails) re.getObject();
System.out.println(pd.ITEMCODE);
}
}
As could not overcome the problem, I dropped the idea of having primefaces provided filters. Now I provided selectOneRadio to specify FruitType and loading the records of the specific Fruit Type in the datatable.