I have a situation where i need to execute a specific component for every row inside a ui:repeat:
<h:form id="form">
<h:panelGroup id="mediaCards" layout="block">
<ui:repeat id="media" value="#{mediaManager.entries}" var="m">
<div class="media-card">
<h:outputText id="keyword" value="#{m.keyword}" />
<h:outputText id="producer" value="#{m.producer}" />
<h:outputText id="location" value="#{m.location}" />
<!-- many other fields -->
</div
</ui:repeat>
<h:panelGroup>
<ui:remove>actual solution</ui:remove>
<h:commandButton value="Send keywords to Server">
<f:ajax execute="mediaCards"/>
</h:commandButton>
</h:form>
Currently i execute the whole HTML which is too heavy since i have lots of media-cards and i am only intereseted in executing just every keyword for each row.
As an alternative, i could attach an ajax-change listener to every keyword. but making a server-communication on each change-event is also not the best here.
<h:outputText id="keyword" value="#{m.keyword}">
<f:ajax/>
</h:outputText>
What i would like to have is a dynamic approach of
<h:commandButton value="Send keywords to Server">
<f:ajax execute="media:0:keyword media:1:keyword media:2:keyword media:3:keyword"/>
</h:commandButton>
Can we do this in a preferably clean way?
Note: i use mojarra 2.2.14 without primcefaces but omnifaces.
Edit: replacing ui:repeat with c:foreach leads to the same problem:
<c:forEach value="#{mediaManager.entries}" var="m" varStatus="row">
<div class="media-card">
<h:outputText id="keyword_#{row.index}" value="#{m.keyword}" />
</div
</c:forEach>
<ui:remove>what to do here?</ui:remove>
<h:commandButton value="Send keywords to Server">
<f:ajax execute="keyword"/>
</h:commandButton>