Pagination In ADF

By scott | February 23, 2011 | 16 Comment

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  where tag was present . remove all the table related tags
The complete code is below.
The iterator code is like below:
                               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…………..

TAGS

16 Comments

16 April, 2011 Reply

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

17 April, 2011 Reply

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.

11 November, 2011 Reply

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

23 December, 2011 Reply

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)

27 December, 2011 Reply

Hi,

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

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

08 February, 2012 Reply

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

21 February, 2012 Reply

Hi,
Can you share the code?

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

27 March, 2012 Reply

Hi,
Can you share the code?

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

06 April, 2012 Reply

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

01 May, 2012 Reply

Hi,
Can you share the code?

Thank you.

tsendee0505@yahoo.com

14 May, 2012 Reply

Hi,
Can you share the code?

Thank you.

nadejda.belan@gmail.com

04 June, 2012 Reply

Hi,
Can you share the code?

Thank you.

dgajevic@gmail.com

27 July, 2012 Reply

Can you Share the code

Thanks you.
santhosh.dona@gmail.com

27 August, 2012 Reply

Can you Share the code with me as well?

Thank you.
chelis.flores@gmail.com

29 March, 2013 Reply

HI ,
Wil you please shate the same code with me as well
i will be very thankfull

Thank you
nr.raut@gmail.com

03 July, 2013 Reply

Hi,

Could you please share the code with me

sajith.sasi@gmail.com

Leave a Reply

Your email address will not be published. Required fields are marked *