Sunday, January 9, 2011

Declaratively setting the current row key in a ViewObject

In this post I'm sharing simple example illustrating the declarative approach for overriding the default selected row of a ViewObject. Please take a look at the following screen shot, the row selection of the Department details displayed inside the 'paginated parameter form' changes in accordance with selection in the drop down list (displayed on the top of the screen). In other words, the row selection of a ViewObject for the parameter from changes in accordance with value from the drop down list.


A glance at the implementation

This example gets the row key of the currently selected item from selectOneChoice, and uses the same for setting the 'current row' for the ViewObject used for displaying parameter form in the task flow. Please note that, 'current row key' can be declaratively retrieved by making use of built in 'currentRowKeyString' method from iterator used for building the selectOneChoice. As I mentioned earlier, this key is passed as parameter to the task flow, displayed below the drop down list. This task flow is having 'SetCurrentRowWithKey'(from the DepartmentsViewObject iterator) as default activity, followed by a view activity to display the department and employee details. The 'SetCurrentRowWithKey' method call activity used in the above task flow is built by dragging and dropping the 'SetCurrentRowWithKey' operation displayed in the data control under the iterator used for building parameter form.

setCurrentRowWithKey: Tries to finds a row using the serialized string representation of row key passed as a parameter. If found, that row becomes the current row.

Please see topic '23.2.3 What You May Need to Know About Setting the Current Row in a Table' in Fusion Developer's Guide to lean more about 'SetCurrentRowWithKey'.

You can download the sample workspace from here.
[Runs with Oracle JDeveloper 11g R1 PS2 + HR Schema]

2 comments:

Taufeeq said...

Sir,

How to set initial focus programatically in a table for the field when add button is clicked.

ஜெ.ராஜ்குமார் said...

Hi Jobinesh,

Thanks for your solution. You are doing a great job. All your blogs are very useful. Carry on your great work.

Regards,
Raj