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.
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.