ADF 11g : SelectOneRadio in Table Layout

Today at one of my customers I was asked the question if you can use a SelectOneRadio component in table layout. I know that the first thing they should have done is try Google to find a solution. As a matter of fact they did and found this blogpost by Frank Nimphius. This however is based on ADF 10g. The part where Frank converts the InputText to a selectOneRadio isn’t available in ADF 11g anymore. It can be achieved in ADF 11g very simple as well

Based on an example I will explain how to do this in ADF 11g. For this I added an extra column to the EMPLOYEES table. This column called “OutOfOffice” holds the status of the selected employee. I created ADF BC for the Employees table. When dropping this as an ADF table you will see the result as below.

ADF 11g : SelectOneRadio in Table Layout noRadio
Not user-friendly at all. But how can we change this ?

Actually it’s simple. First remove the inputText field from the column.
Next drop the OutOfOffice attribute from the datacontrol on the column as a selectOneRadio.

ADF 11g : SelectOneRadio in Table Layout dropAd
In the ListBinding editor select Static List and add the static values. In this case just Y and N.

ADF 11g : SelectOneRadio in Table Layout ListBindingIn the pageDef this looks like this:

ADF 11g : SelectOneRadio in Table Layout pagedefThe choices in the selectOneRadio will be displayed in a vertical layout. For a table I prefer horizontal layout. This will not change the height of the rows.

ADF 11g : SelectOneRadio in Table Layout layoutNow when you run the page it looks a lot better.

ADF 11g : SelectOneRadio in Table Layout yesRadio
And that is all you have to do.

A sample workspace can be downloaded here.

One Response

  1. Yahia Momtaz December 29, 2013