1 2 Previous Next 17 Replies Latest reply on Jul 31, 2013 12:36 PM by vinaykumar2 Go to original post
      • 15. Re: adding new option in selectonechoice
        Timo Hahn

        I made a test case with out use case:

        here is the code from the page. mySeletion1 is an Integer variable in the binding layer.

                                <af:panelGroupLayout id="pgl2">

                                    <af:selectOneChoice label="Label 1" id="soc1" value="#{bindings.mySeletion1.inputValue}" autoSubmit="true">

                                        <f:selectItems value="#{viewScope.SelectOneBean.valueList}" id="si1"/>


                                    <af:outputText value="Selected Value: #{bindings.mySeletion1.inputValue}" id="ot2" partialTriggers="soc1"/>


        here is the bean code

            List<SelectItem> valueList = null;



            public List<SelectItem> getValueList() {

                if (valueList == null || valueList.size() == 0) {

                    valueList = getYourValueListFromServiceByRunningQuery();




                return valueList;




            private List<SelectItem> getYourValueListFromServiceByRunningQuery()




                valueList = new ArrayList<SelectItem>();

                List valueListFromBinding = new ArrayList();

                BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();

                // Get a attribute value of the current row of iterator

                DCIteratorBinding iterBind = (DCIteratorBinding) bindings.get("DepartmentsIterator");






                RowSetIterator rowIter = iterBind.getRowSetIterator();

                Integer count = 0;

                while (rowIter.hasNext()) {


                    SelectItem selItNew = new SelectItem();

                    Row row = rowIter.next();

                    String nameValue = (String) row.getAttribute("DepartmentName");

                    System.out.println("configGrp name: " + nameValue);







                SelectItem selIt = new SelectItem();







                return valueList;


        As I don't have your data I use the departments VO to get the names for the select items.



        1 person found this helpful
        • 17. Re: adding new option in selectonechoice

          see this af:selectonechoice not getting updated | They point the finger at me.. again!



          it will help u. Set value as integer.if u need the value of selectonechoice. when u set value in selectitem, u can also put value and label in hashmap, and using valuchangelistener u can get the integer value and pass into hashmap and get value of selectonechoice...

          1 2 Previous Next