Saturday, June 30, 2012

Define the default sorting order of an ADF table


An ADF table is based on a collection and displays data sorted in the order defined in the ADF iterator,
which actually is how the data is queried by the business service. If you need data
to be sorted differently by default, you can do it by configuring the ADF iterator.
Here are the few steps to fellow:
In our exemple, we will change the default sorting of af:table displaying Departments.We will sort the table's data by the DepartmentName attribute.
First, you select the Binding tab at the bottom of the ADF bound page or page fragment where the af:table is located.


Select the Iterator binding, Departments1Iterator  in our exemple, and press the pencil icon to edit
the binding configuration.


Then switch to the Sort Criteria tab to define the new sorting order to be applied when the data is
displayed in the page.


Choosing Ascending or Descending as a sort option on any attribute will change the table initial data ordering. In our case, we will sort our Table by the DepartmentName attribute.


You can notice after running the page that the DepartmentName column is sorted.