Get current row from ADF UI attribute

Source: GitHub

This is a quick blog post which showcases the power of ADF UI components' attribute. Alternatively, this blog post could also have had a heading of "Getting current row when af-table's row selection is disabled", but I randomly chose the former.

A typical use-case for such a requirement could be that the customer does not want any row selection, in order to improve the page performance, as every row selection change calls for a server trip wherein lot of information gets stored on the ADF framework.

But we also need a mechanism where, if an editable attribute of the ADF table is modified, we should be able to extract the row on which the operation was performed. Since row selection is disabled, the framework has no information of current row.

Here is where we can make use of <f:attribute>. We create a new attribute on the editable column, which holds "#{row}" value. This row expression comes from var attribute of the ADF table, which stores a ton of information, including our desired row.

From the Value-Change-Listener, we can get a handle of this attribute, and cast it into an instance of JUCtrlHierNodeBinding, from where we can extract the row on which the editable component exists.