Dynamic table binding in ADF

JDev: 12.2.1.4.0
Source: GitHub

This article aims to show a use-case where you can switch dynamically between multiple view instances on an af:table component. This is an interesting feature, using which you can maintain a consistent front-end, while only switching between the view instance names bound to the table component.



The radio buttons are bound to 2 values: DepartmentsVO1 and EmployeesVO1, which are the names of the tree bindings for the view instances created on the page definition.



The only UI code to be written for this implementation is a template for af:table, whose value and columns are derived from the bindings.


The value and column attributes are derived from the binding itself:


The interesting added bonus is the way we are handling the column labels. In order to allow us the flexibility of accessing the label hints from the bundle file, we access the label from the bindings.VO-INSTANCE.hints.ATTRIBUTE-NAME.label map.


And that is all.

Now what can be the utility for such an approach? I can think of a quick development process, where, in order to display the results from a new view object, all you need to do is to add a new binding for the new view, since your UI is already done.

Cheers!

Comments