1

I'm using the Tomahawk t:dataScroller for pagination. It is working really well. There is only one issue that I'll try to explain:

Page A contains the t:dataTable, which is paginated with the t:dataScroller. There are links in the dataTable that can redirect me to another page, say page B. When I go back from B to A, the state of the pagination is restarted.

What I mean is that, if, in Page A, I'm at the 5th page, and then move to page B, when I go back to A, I'll be at the 1st page on A.

Does anyone have gone through this? Does anybody have any idea?

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880

1 Answers1

2

You can take control of 'first' property of the datatable. What you need to this,

  1. Declare a public/protected variable in your session bean,

    @ManagedBean @SessionScoped public class DataTableController implements java.io.Serializable { protected int first; // getters and setters...

  2. Bind it with the 'first' property of datatable

    <p:dataTable id="results-table" var="result" ... first="#{dataTableController.first}"

  3. While navigating between the pages, store the 'first' record value using something like this,

    public void onPageChange(PageEvent event) { this.setFirst(((DataTable) event.getSource()).getFirst()); }

For more details, follow the link. http://forum.primefaces.org/viewtopic.php?f=3&t=25399#p80324

BTW Thanks for the comments

SaravMani
  • 83
  • 8