Sunday, February 24, 2013

How to use af:selectManyChoice> Component in ADF

Usecase :  How to use af:selectManyChoice component.

Implementation

Below is the sample screenshot how this component looks like. User can allowed to select more than one item.


Below is the snippet in Page fragment,  ValueChangeListener method binding is optional. this is one way of getting selected values. <f:selectItems> value can bind to any data source. In this example I have pointed to one Java class that returns list of <SelectItem>'s



This is how we can populate List of SelectItem values, I have configured this class in faces-config.xml, so that every page fragment can access these values.




Below screenshot shows how to get the selected value from <af:selectManyChoice> component by changing value on it. valueChangeEvent.getNewValue() returns selected values in form of java.util.ArrayList<Object>

Note : If you bind <f:selectItems> to List<SelectItems> , You will always get the selected item(s) key value instead of index value.












1 comment:

  1. sir can you please advise on:
    https://community.oracle.com/thread/3574628

    ReplyDelete