I have a p:dataTable which stores the results of a processed form, and I perform the following actions:
- Fill form values.
- Submit.
- Data table is populated -- filter on any column.
- Change form values.
- Submit.
- Data table is populated with new results.
- Sort on any column -- filtered results from #3 are displayed.
I have an arraylist for the filtered values, but I am not doing anything to it in the bean. On submit, I am calling an actionListener which casts the dataTable to primefaces.components.datatable.DataTable and then calling a resetValue() on it (see code snippet below), before I process the form.
I've tried multiple ways of resetting, clearing and updating the dataTable, but I'm not able to get around the above issue. Just for reference, this is my p:dataTable tag:
<p:dataTable
id="resultsDataTable"
rendered="#{entityReportBean.isResultsPopulated}"
var="change"
value="#{entityReportBean.entityChangeDto}"
styleClass="resultsPanel"
rows="100"
paginator="true"
paginatorPosition="top"
paginatorTemplate="#{PreviousPageLink} Previous {CurrentPageReport} Next {NextPageLink}"
filterEvent="enter"
filteredValue="#{entityReportBean.filteredResults}" >
and this is the actionListener:
public void onSubmit() {
FacesContext context = FacesContext.getCurrentInstance();
DataTable resultsTable = (DataTable) context.getViewRoot().findComponent("results:resultsDataTable");
resultsTable.resetValue();
...
I am fairly new to JSF/Primefaces so there might be some basic operation I'm unaware of. Any suggestions?