Friday, April 12, 2013

ADF: After long time, table pagination feature has returned back in JDev11.

After a very long time since JDeveloper 10g, oracle jdeveloper 11g team has decided to remove a wonderful feature, which is the table's pagination feature.

Since that time when I have developed any project, I get the long list of scrolled data in the tables, and I have many complaints from my customers whose they need pagination feature.

I have developed a custom ADF Declarative Component to solve the pagination problem, to be used in my projects to fit my customer requirements.

I am a frequent updater for Jdeveloper, and recently Oracle has released JDeveloper v11. and surprised me with many of new features released.

But the most exciting one of existing features is Table Enhancements but the top one is returning back the pagination feature, other enhancement as the following:

  • Support for freezing the right most columns in a table so that a scroll bar appears on the left side of the frozen columns.
  • Table/TreeTable - Both components allow configuration of the paging vs. scrolling via the new scrollPolicy attribute.

Let's see how we can achieve that through the following steps, figures and code snippets.

  1. Creating the project:
    1. File > New > General > Application >Items > Fusion Web Application (ADF) > click OK button.
    2. On the create page > click Finish (Alt + F).
    3. Application > Application1 should be created as the following fig:

  2. Creating the business and presentation:
    1. On ViewController project > Right click and choose New > Categories >Web Tier > JSF > Items > JSF Page > click OK.
    2. On create JSF Page pop up >File Name: ValueList.jspx > check "create as XML Document (*.jspx)" > In initial Page layout and content > choose: Quick start layout.
    3. Open Page Implementation >choose: Automatically Expose UI > leave everything as is.
    4. Your screen configuration should be as the following:

    5. Click OK.
    6. An Empty page will be open in the editor.
    7. Go to package view.backing under ViewController project >New > Categories >General >Java > Items > Java Class > OK > Name: Employee > OK.
    8. Employee, ValueList classes, adfc-config.xml and ValueList.jspx  page should be as the following code snippets:

    9. Right click on ValueList.jspx page and choose run, and when it runs, you should see the following output:

  3. Rendering rules (VIP Note):

    In order for a table to display as paginated, you must set the scrollPolicy attribute to page, the autoHeightRows attribute to 0, and the table must be placed in a flowing container (that is, a component that does not stretch its children). If these conditions are not met, the table will display a scroll bar.

No comments :

Post a Comment