ADF:TABLE – Get Selected Row or Rows

ADF:TABLE – Get Selected Row or Rows

ADF does an excellent job of making short work binding data to rich UI components. One of the most common use cases beyond basic presentment of data, is the ability to allow a user to select a row or rows of data presented and then act on it in some way.

We are going to look at both scenarios by way of a generic example, allowing us to perform both single and multiple row selection, then perform an action on the basis of the data item involved with the selection.

Our ADF Table Row Selection sample application uses a Placeholder Data Control that exposes some sample support issues for use in our JSPX page.

How to Get a Selected Row or Rows in an ADF Table – Our Example
The following explanation describes the steps taken in the sample application (source at bottom of post) and highlights the key areas of ADF that allow us to access this data from our components within a view (page). To create our sample application we

  1. Created a JSPX page SupportIncidents.jspx and made sure that we let JDeveloper “Automatically Expose UI Components in a New Managed Bean”
  2. Dragged and dropped the OpenSupportItems node from the SampleData Data Control onto our JSPX page and selected to represent the data as a ADF-Read Only Table that allows filtering, sorting and Multiple Rows row selection.
  3. After getting the information from the Data Control onto the page – which in and of itself offers rich UI handling, we now needed to get 2 buttons onto the page. To do this we dragged and dropped 2 buttons from the Resource Pallete from Common Components under ADF Faces
  4. Now is when the rubber meets the road and we dive into our backing bean to respond to actions taken on the buttons by end users. To do this we right click on out buttons and make sure to “Create Method Binding for Action”. This will generate a place within the backing bean to hold our logic to respond to a button click. We did this for both buttons, as they will use sample logic to illustrate getting all items selected in the table vs a single item

Once we accomplished the above, we were ready to write our backing bean code. In our backing code we access information created by ADF when we dragged and dropped part of our Data Control onto the page. When attempting to retrieve a selected value(s) from our table we need to locate the binding that was applied to the ADF Faces component. Where can we find this?

When we open our JSPX page we can view it in 5 ways – Design, Source, Bindings, Preview and History. The bindings tabs holds the key to what is needed to find our bindings in the backing bean and use in the following line

Now that we know the magic designation to get the specific binding for our table data, let’s look at the two buttons in our sample and how we can get a single selected value or get multiple selected values (when a user Ctrl right clicks many rows or Shift clicks many rows).

Method Binding for Action for Button 1 – Getting a Single Selected Value

Method Binding for Action for Button 2 – Getting a Multiple Selected Values

Download the ADF Table Row Selection sample application

I hope that this post has been able to save people some time when getting their feet wet with ADF. Once you understand this pattern ADF development can move very rapidly.

Special thanks to Zeeshan Baig and his ADF related blog posts which have been very helpful learning ADF development and unlocked some details around ADF data binding for me!


Thx God Bless You خیلی باحال بود


Wonderful example. Worked perfect! Thank you.


està buena, gracias por la aportación


  1. […] This post was Twitted by JRSim_UIX […]