Thursday, November 11, 2010

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.

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.

In the ListBinding editor select Static List and add the static values. In this case just Y and N.

In the pageDef this looks like this:

The 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.

Now when you run the page it looks a lot better.

And that is all you have to do.

1 comment:

Anonymous said...

nice post !