Search This Blog

Showing posts with label ADF faces. Show all posts
Showing posts with label ADF faces. Show all posts

Friday, 17 April 2009

How to Add Row Filtering to an af:table which wasn't setup initially for this

When you add an ADF Read Only table to a JSF page you can add "Row Filtering" to the table. Here is how to set this on a table which was not setup with "Row Filtering" and you now wish to enable it now.

1. Right click on the JSF page which contains the "af:table" and select "Go To Page Definition".
2. In the structure window right click on "Executables" and select "Insert inside executables -> search region".
3. Enter an ID as follows -> SrListQuery
4. Alter binding XML file so it adds these 3 attributes as shown.

<searchRegion
Binds="SrlistView1Iterator"
Criteria=""
Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
id="SrListQuery"/>

5. Switch back to the JSF page and go to the source editor and add these 3 attributes in bold to your "af:table". You must use "SrListQuery" which is the Id for the search region executable.

<af:table
value="#{bindings.SrlistView1.collectionModel}"
var="row" rows="#{bindings.SrlistView1.rangeSize}"
emptyText="#{bindings.SrlistView1.viewable ? 'No rows yet.' : 'Access Denied.'}"
fetchSize="#{bindings.SrlistView1.rangeSize}"
filterModel="#{bindings.SrListQuery.queryDescriptor}"
queryListener="#{bindings.SrListQuery.processQuery}"
selectedRowKeys="#{bindings.SrlistView1.collectionModel.selectedRow}"
selectionListener="#{bindings.SrlistView1.collectionModel.makeCurrent}"
rowSelection="single" id="table"
filterVisible="true">

Finally we need to determine which columns we wish to allow filtering to occur for which we do as follows

6. Select the "af:column" tag in the structure window.
7. Click on the + symbol to expand the "Behavior" options in the property inspector.
8. Set "Filterable" to "true".
9. Repeat steps 6 - 8 for each column you wish to be filterable.

Now when you switch to design view of your JSF page you should see your table which has a row on the top of the table which enables row filtering for the columns you enabled this for.