ADF Adventurers Only.Retrieve af:selectOrderShuttle selected value.

ADF Adventurers Only.Retrieve af:selectOrderShuttle selected value.

Greetings fellow ADF Adventurers. Let me share you some of my experience, so you can level-up faster.

The case

Recently I had to use the af:selectOrderShuttle. I supposed this to be straightforward, but it isnt. Normally we should do something like this one in the article:

But it didnt work in my case.

For some reason, calling:


was not preserving the user selection.

The solution

Initially everything is as normal. We have some ViewObject,  let us say TaskТеmplateVO added to Application Module.

We drag it on the page as af:selectManyShuttle


We select the Id attribute while we show the Name attribute to the user.

Валери 2


The default drag options is af:selectManyShuttle, which we change later on to af:selectOrderShuttle

The result is:

af:selectOrderShuttle value="#{bindings.TaskTemplateVO.inputValue}"
                         	leadingHeader="List 1"
                         	trailingHeader="List 2"
                         	valuePassThru="true" id="sms2
    	f:selectItems value="#{bindings.TaskTemplateVO.items}" id="si1"/

We will change that so we have our selection available in Managed Bean.

af:selectOrderShuttle value="#{pageFlowScope.TestBean.selectedItems}"
                         	leadingHeader="List 1"
                         	trailingHeader="List 2"
                         	valuePassThru="true" id="sms2"
    	f:selectItems value="#{bindings.TaskTemplateVO.items}" id="si1"

So far, everything is ok. We can iterate over the selection and we can retrieve the user selection.

for (String numberId : selectedItems) {



But there is one issue, the selection holds the index of the selection.

Not Id, not Name, it holds index!

valuePassThru=”true” does not seem to work. What can we do about that and retrieve the real value that we need?

Issue solution

Approach 1
We can access the iterator that we have in the Page Definition, and retrieve the row by an index.

for (String numberId : selectedItems) {
Row row =
ADFUtils.findIterator("TaskTemplateVOIterator").getRowAtRangeIndex(numberId );

Approach 2

We will create a map when the page loads and store the values that interest us in it.

In this case, we will create a map containing Index and Id.

public TestBean() {
Row[] taskTemplateRows =
int index = 0;
for (Row row: taskTemplateRows){

TaskTemplateVORowImpl rowImpl = (TaskTemplateVORowImpl)row;
//System.out.println("putting" + new Number(index) + " id " +  rowImpl.getId()  );
allHeaderTasks.put(Integer.toString(index), rowImpl.getId());



And now whenever we need to return the selected Id-s we can do this:

for (String numberId : selectedItems) {
System.out.println("getting " + allHeaderTasks.get(numberId));</i>

You just gained a level!


Valery Borisov

JavaEE and Oracle Developer at Dreamix

More Posts - Website

Follow Me:

Do you want more great blogs like this?

Subscribe for Dreamix Blog now!