ADF Faces provides long list of rich UI components. One of them shuttle component, it allows to create shuttle type multi-selection lists out of the box. We were looking how to access shuttled items programmatically, didn't found any proper info on the Web - decided to contribute to community with one more hint. If you will read ADF Faces developer guide, there is a suggestion to use ADFShuttleUtils Java Script object in order to access shuttle items. This means you would need to implement af:clientListener for Java Script invocation and so on, but I'm not a big fan of using Java Script for such scenarios. Let's find easier and better solution.
Download sample application - ShuttleAccessApp.zip. This simple application implements ADF Select Many Shuttle and provides managed bean methods to operate this component:
You only need to specify Base and Display attributes, then ADF Select Many Shuttle is defined:
List binding - DepartmentsView1, will be defined inside Page Definition file - we will use this binding to access shuttled elements from managed bean:
Here is the most interesting part, instead of using Java Script API, you can simply get the list binding inside managed bean and iterate through shuttled items:
It could be common requirement to clean shuttled items with external button, we can achieve this by clearing selected indices:
Shuttle some items and press Process Selection button:
We access shuttled items from managed bean:
Press Clear Selection button to remove shuttled element, this will clean shuttle programmatically:
Download sample application - ShuttleAccessApp.zip. This simple application implements ADF Select Many Shuttle and provides managed bean methods to operate this component:
You only need to specify Base and Display attributes, then ADF Select Many Shuttle is defined:
List binding - DepartmentsView1, will be defined inside Page Definition file - we will use this binding to access shuttled elements from managed bean:
Here is the most interesting part, instead of using Java Script API, you can simply get the list binding inside managed bean and iterate through shuttled items:
It could be common requirement to clean shuttled items with external button, we can achieve this by clearing selected indices:
Shuttle some items and press Process Selection button:
We access shuttled items from managed bean:
Press Clear Selection button to remove shuttled element, this will clean shuttle programmatically:








10 comments:
Hi,
I'm new in ADF.
I Created a new components programatically and now i want make these components selectable to delete a specific one.
any help plz
ps: sorry for my bad english.
Khayem
Hi
Thank u for a wonderful post. i am using the vo based on an EO and i want to save the selected one in database...i tried doing it from AMImpl but it is not working can u suggest me something to achieve this.
Hi, i'm new to ADF 11G, my problem is that i have a table with two columns for example: Acces (it has some data) and another is Denied with data too, i want to put a af:SelectedManyShuttle component, binding the table getting leading list with data Acces column and trailing list with data Denied column, how could i do that?, can you help me pls?, sorry for my english. regards
Dario
You can use sample app from this post, it should cover your use case.
Andrejus
Hi,
is it possible to initialize the component, with the previously added items selected ?
eg: these are the items (A,B,C,D,E,F)
first time user selects :(E,F)
when second time the form opens up it shows (E,F) as selected,again user adds (A,B)
the third time it shows (E,F,A,B) as selected ...and so on
Thank you
Yes, you will need to store selected values in database and then every time before rendering Shuttle, make sure to use setSelected(key) to prepare selected values.
Andrejus
Thanks for your post but I still need help.
I have a selectManyShuttle which is getting value programatically.
Steps:
1: Selected few values from available.
2: Created one more value and added into available list (It happens in a popup).
3: After I close the popup, newly created value is added into available items but selected items are getting disappeared.
4: Here I want to keep the selected values as selected even after adding a new item.
Any idea how can I do it?
If its more complex requirement, you may implement as two regular tables.
Andrejus
Hi Andrejus ,
Can we keep the selected values as selected after the refresh of selectManyShuttle. This refresh will add one more value in available values.
Hi,
Can we use a tree component in he shuttle component.
My requirement is to show the item from left pane to move to right pane under a certain value, something like a tree.
eg
Ship From Ship To
========= =======
Shpdvc pack1 shpdvc rac1
--item1 --item2
Shpdvcpack2 shpdvc rac2
--item3 --item5
--item4
now if I move item4 from shpdvc pack2 to shpdvc rac2, then it will look like :
Ship from Ship to
========= =======
Shpdvc pack1 shpdvc rac1
--item1 --item2
Shpdvcpack2 shpdvc rac2
--item3 --item5
--item4
Any Pointers?
Thanks
Sumit Yadav
Post a Comment