1
votes

This is my .xhtml file

<tr:selectOneChoice >
   <f:selectItems value="#{bean.items}"/>
</tr:selectOneChoice>

I want to be able to identify between the different options in the client side. In my backing bean I have boolean for each Choice.

Is it possible to actually identify between this options in the client side ?

The bean code goes like this :

public List<SelectItem> getItems(Menu menu) {
    List<SelectItem> list = new ArrayList();
    SelectItem selectItem = new SelectItem(new MyObj("some string",false), "label");
    list.add(selectItem);
    return list;
}

MyObj class contains the flag that I want to be able to see in the client side.

any one know how to do that ?

thanks ,

John.

1

1 Answers

0
votes

Why don't you just create a List of MyObj, iterate through the list and use the itemDisabled attribute on f:selectItem.

<tr:selectOneChoice>
  <tr:forEach items="#{bean.myObjList}" var="myObj">
    <f:selectItem itemLabel="#{myObj.label}"
                  itemValue="#{myObj.value}"
                  itemDisabled="#{myObj.flag}"/>
  </tr:forEach>
</tr:selectOneChoice>