If you give partial triggers an EL expression it must evaluate to type
String[]. The value change listener is fired for the current
iteration, so if you click item 3, the event will be broadcast for the
selectOneChoice inside the index 2 of tr:iterator. To move the
iterator to a new index you need to save the current row index, set
the new index, evaluate code and then set it back.

An iterator stamps out one component and a component only has 1 ID, so
you cannot put EL in the ID like you did below. I would advise using
<f:attribute/> if you need to store the ID on the component, but just
give the choice a static ID.

The resulting IDs on the client will be like "i1:0:soc1", "i1:1:soc1",
etc if your iterator had ID "i1" and your selectOneChoice had ID
"soc1". So the :#: in between represents the stamp index.

-Andrew

On Fri, Sep 4, 2009 at 7:32 AM, Roeder,
Andreas<[email protected]> wrote:
> I'm trying to create generic selectOneChoice elements. When the first 
> selectOneChoice value changes it should update the next one in the list and 
> so on.
> I tried to do that via the id, partialTriggers and a ValueChangeListener:
>
> <tr:iterator value="#{genericFormBean.formDesc.fieldList}"
>                                var="field">
>  <tr:selectOneChoice
>        id="#{field.id}"
>        partialTriggers="#{field.partialTriggers}"
>        valueChangeListener="#{genericFormBean.valueChange}"
>        value="#{genericFormBean.formDesc.modelMap[field.id]}"
>        <f:selectItems
>                value="#{genericFormBean.selectItemMap[field.itemList]}" />
>  </tr:selectOneChoice>
> <tr:iterator>
>
> But I cannot set the id of the selectOneChoice element. When I try to get the 
> other selectOneChoice elements in the valueChangeListener I just see one 
> element in the iterator.childs() collection. Why is that?
>
> I also tried to use a custom renderer to set the id, but as soon I change the 
> id of one selectOneChoice element all other elements are getting the same id.
> It's pretty confusing to me.
>
> Is there another way to do that?
>
> Best Regards,
>
> Andreas
>
>

Reply via email to