In JSF, <ui:repeat/>
and similar components such as PrimeFaces <p:dataTable/>
generate dynamic ids for sub-components based on the iteration index, i.e.:
<p:dataTable id="table" var="item" value="#{itemList}">
<h:outputText id="name" value="#{item.name}"/>
</p:dataTable>
will generate something like this:
<table id="table">
<span id="table:0:name">name0</span>
<span id="table:1:name">name1</span>
<span id="table:2:name">name2</span>
...
<span id="table:n:name">nameN</span>
</table>
so all the elements clearly have a distinct client id. I intentionally skipped the <tr/>
, <td/>
, etc.
So, <p:ajax ... update=":table:name"/>
refers to all the names in the table and it works fine, <p:ajax ... update=":table:#{someDesiredIndex}:name"/>
fails with a message similar to SEVERE: javax.faces.FacesException: Cannot find component with identifier ":table:0:name" in view.
event though I can confirm that the component exists in the markup. Is it not possible to do this?
I'm running on GlassFish 3.1.2 and Mojarra 2.1.6 in case it is relevant.