This post is about a very simple use case that is reordering of af:table column at run time.
Ordering of columns in af:table is controlled by DisplayIndex property of af:column
Check what docs says-
Default Value: -1
The display order index of the column. Columns can be re-arranged and they are displayed in the table based on the displayIndex. Columns are sorted based on the displayIndex property, columns without displayIndex are displayed at the end, in the order in which they appear. The displayIndex attribute is honored only for top level columns, since it is not possible to rearrange a child column outside of the parent column.
Not supported on the following renderkits: org.apache.myfaces.trinidad.core
We can set DisplayIndex property for all columns in a sequence (1,2,3 etc) that we want to see on page
Here i am using a HashMap to change DisplayIndex of columns at runtime
Let’s see implementation part-
- Prepare Model using Departments table of HR Schema and dropped viewObject as table on page
Page structure window. Read the complete article here.
For regular information become a member in the WebLogic Partner Community please visit: http://www.oracle.com/partners/goto/wls-emea ( OPN account required). If you need support with your account please contact the Oracle Partner Business Center.