문제

Assume that I'm using this component as following:

<tr:selectOneChoice label="Sports" required="#{true}" showRequired="#{true}">
 <f:selectItem itemLabel="Swimming" itemValue="1" />
 <f:selectItem itemLabel="Football" itemValue="2" />
 <f:selectItem itemLabel="Soccer" itemValue="3" />
 <f:selectItem itemLabel="Running" itemValue="4" />
  <f:selectItem itemLabel="Sailing" itemValue="5" />
    <f:facet name="help">
     <tr:outputText value="Please select" />
   </f:facet>     
</tr:selectOneChoice>

Is it possible to add dynamically new item to the list after some event trigger from the server?

I'm mean let's say the user has select some item and then, before submit an event was fire from the server which should change the selected item to some other item.

Thanks!

도움이 되었습니까?

해결책

Yes. this is possible but you have to define a list which is mapped in backing bean like:

<tr:selectOneChoice label="Sports" required="#{true}" showRequired="#{true}">   
    <f:selectItems value="#{backingBean.values}" />    
</tr:selectOneChoice>

Notice the difference here f:selectItems is being used instead of f:selectItem

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top