Wednesday, 23 February 2011

Pagination In ADF

Pagination is one common requirement in many projects. But in ADF 11g we have only scrollable facility available. So it becomes quiet tedious job to handle huge data.

First create one Fusion Web Application.

And create the ADF Business Components (I have used Employees Table of HR schema (Oracle XE))





Now create your page. For saving time I have created One ADF Read Only Table by dragging EmployeesView1 from data control to the page.



Now create <af:iterator> where <af:table> tag was present . remove all the table related tags

The complete code is below.

The iterator code is like below:
<af:iterator id="i1"
                               value="#{bindings.EmployeesView1.collectionModel}"
                               var="row"
                               binding="#{pageFlowScope.testPageBean.myIterator}">


Now create one managed bean (TestPagebean.java here). I have created the bean in page flow scope.

create the value change listener and action listener.

The valuechange listener code will be like this :

UIXIterator valueIterator = getMyIterator();
        if (!valueChangeEvent.getNewValue().equals(valueChangeEvent.getOldValue())) {
            int newPage =
                Integer.parseInt(valueChangeEvent.getNewValue().toString());
            int pageStart = (newPage) * valueIterator.getRows();
            valueIterator.setFirst(pageStart);
            AdfFacesContext.getCurrentInstance().addPartialTarget(valueIterator);




Now run the page you will get desired output.

The complete code is below.









Please add in comments for queries..............

17 comments:

  1. Hi,
    In case from the database will be taken 5 millions of rows, how will the application or the WLS manage this rows? because I got on 1 million "Out of memory error". Will pagination resolve this problem? Or the 5 millions of row will anyway be taken from database and the server will throw "Out of memory error"?
    Thanks
    Corneliu

    ReplyDelete
  2. I have not tested with 5 million records but I think it depends on how you design and do the administration.
    If you extract the data on demand basis (not all the data at one fetch),do not cache the previous data and configure weblogic server's garbage collection properly then it should solve your problem.

    ReplyDelete
  3. Can you share the code. Please. I like to implement like 1 2 3 4 5..... My email is cnbaluramesh@gmail.com

    ReplyDelete
  4. Hi,

    Can you please share the code? would be very usefull for me to see it.

    Thank you.
    (my email adress is sorina_popa04@yahoo.com)

    ReplyDelete
  5. Hi,

    Its a very good article.Can you please share the code?

    Thank you.
    (my email adress is nutantanu@gmail.com)

    ReplyDelete
  6. Hi ,
    Nice. Can you share the code ?
    (email is: sohahm_1@yahoo.com)
    Thanks.

    ReplyDelete
  7. Hi,
    Can you share the code?

    Thank you.
    (my email address is phamduytan2009@gmail.com)

    ReplyDelete
  8. Hi,
    Can you share the code?

    Thank you.
    (my email address is krshmathavan@gmail.com)

    ReplyDelete
  9. Hi ,
    Nice. Can you share the code ?
    (email is: wwweigh@gmail.com)
    Thanks.

    ReplyDelete
  10. Hi,
    Can you share the code?

    Thank you.

    tsendee0505@yahoo.com

    ReplyDelete
  11. Hi,
    Can you share the code?

    Thank you.

    nadejda.belan@gmail.com

    ReplyDelete
  12. Hi,
    Can you share the code?

    Thank you.

    dgajevic@gmail.com

    ReplyDelete
  13. Can you Share the code

    Thanks you.
    santhosh.dona@gmail.com

    ReplyDelete
  14. Can you Share the code with me as well?

    Thank you.
    chelis.flores@gmail.com

    ReplyDelete
  15. It's kinda hard to understand if there is no code example to referece from??

    ReplyDelete
  16. 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
  17. Thanks for sharing this blog. The content is beneficial and useful. Very informative post. Visit here to learn more about Data Warehousing companies and Data analytics Companies. I am impressed by the information that you have on this blog. Thanks once more for all the details.Visit here for Top Big Data Companies.

    ReplyDelete