ADF – How to get Selected Row when Row Selection is disabled

I am using jdev and due to some reasons, I have disabled row selection in my table. And I have given a check box for allowing the user to select a row. If Row selection is enabled, any row on which the user clicks becomes the current row and hence can be easily accessed in code. This post shows how to access a selected row when the row selection feature is disabled.

In short, when the user clicks on the checkbox, I want to get the row on which user has clicked the checkbox.
So I use the following code in my value change listener.

Method 1:

FacesCtrlHierNodeBinding changedRow = (FacesCtrlHierNodeBinding)linesTable.getRowData();

and u can get any attribute from the row using changedRow.getAttribute();

Method 2:

DCBindingContainer bindings = (DCBindingContainer)getBindings();
DCIteratorBinding iter = bindings.findIteratorBinding("LinesVO1Iterator");

List rowKey = (List)linesTable.getRowKey();
Key key = (Key)rowKey.get(0);
Row row = iter.findRowByKeyString(key.toStringFormat(true));

Method 3 :

BindingContext bc = BindingContext.getCurrent();
DCDataControl dc = bc.findDataControl("MyAMDataControl");
ApplicationModule am = (ApplicationModule)dc.getDataProvider();
ViewObject vo = am.findViewObject("LinesVO1");
Row row = vo.getRowAtRangeIndex(linesTable.getRowIndex());

Note : My table has a binding in this backing bean so that I can access it as linesTable variable.

This entry was posted in ADF. Bookmark the permalink.

2 Responses to ADF – How to get Selected Row when Row Selection is disabled


    hii can i get the solution so that i want to disable the property of the VO iterator pointing at the first row in the rowset.

    • Sowjanya Bhupathiraju says:


      Do you mean you dont want the first row as current row by default?
      In that case , please try vo.reset() which points to slot before first row and hence none of the rows will be current row.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s