How to reset p:dataTable to its original state

UI Components for JSF
Post Reply
nirvanbd
Posts: 45
Joined: 16 Oct 2010, 16:17

04 Jan 2011, 17:12

Hi,
I am struggling to get this simple functionality. I have a screen which lists data in p:dataTable according to user input parameters. Once user is done viewing data based on a particular criteria, he will again query the same dataTable with new criteria. My question is how do I reset the state of dataTable so that it is ready for loading new data based on another criteria. Currently, I am using the following code to reset the dataTable, but it doesn't work as expected.
Backing Bean:

Code: Select all

        lazyDataModel.setRowCount (0); //
        dataTable.setPage(1);
        dataTable.setFirst(0);
This works fine temporarily and it seems (on webpage) that dataTable is back to previous state(with 0 rows). However when the user queries the data again, Data table paginator pageLink button stays to where the user was in the previous query, although the data fetched and shown on screen is for 1st page and from 0 row. In short, why does the dataTable paginator pageLinks button remain where it was prior to initializing the dataTable.

regard,
Nirvan.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests