Saturday, 2 July 2016

How to reset af:table pagination to first page in Oracle ADF

This blog we will see how to reset the af:table pagination to predefine page.
Sometimes due to MDS the last visited page number will persist. we need to reset the old page number and set the new page number.
You can use the below code for rest the pagination 


DCIteratorBinding dcIter = (DCIteratorBinding)(BindingContext.getCurrent().getCurrentBindingsEntry()).get("your iterrator Name");
int taskIndex = 1; // It will navigate to the page where 1st element exist.
int range = dcIter.getRangeSize();
int oldStart = dcIter.getRangeStart();
int newStart = taskIndex-(taskIndex % range);
dcIter.getRowSetIterator().setRangeStart(newStart);
dcIter.setRangeStart(newStart);
RangeChangeEvent event = new RangeChangeEvent(tableBinding, oldStart, oldStart+range, newStart, newStart+range);
tableBinding.broadcast(event);
dcIter.getRowSetIterator().setCurrentRowAtRangeIndex(taskIndex % range);
dcIter.setCurrentRowIndexInRange(taskIndex % range);
AdfFacesContext.getCurrentInstance().addPartialTarget(tableBinding);

Thanks...

5 comments:

  1. Where we need to write this method..

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. What is tableBinding here? While using this code I'm getting error at that word. Dow we need to replace with table binding?

    ReplyDelete
  4. Thanks for sharing this great information I am impressed by the information that you have on this blog. Same as your blog i found another one Oracle ADF .
    Actually, I was looking for the same information on internet for
    Oracle ADF Interview Questions and Answers/Tips and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject.

    ReplyDelete
  5. Thanks for sharing this blog. The content is beneficial and useful. Very informative post. Visit here to learn more about Data Mining companies and Data analytics Companies.

    ReplyDelete