I have a PrimeFaces p:accordionPanel
in each of whose tabs there is a form:
<p:accordionPanel id="iterator" value="#{myManagedBean.itemList}" var="item" multiple="false">
<p:tab title="#{item.name}">
<h:form prependid="true">
<h:outputLabel for="field1" value="Field 1:"/>
<p:inputText id="field1" title="Field 1" value="#{item.field1}" />
<h:outputLabel for="field2" value="Field 12:"/>
<p:inputText id="field2" title="Field 2" value="#{item.field2}" />
I think that it being a PrimeFaces accordionPanel is irrelevant and the behavior would be the same if it were, for example, a plain JSF h:dataTable
with a form in each row.
What I would like to do (without detailed explaining why) is, once the user focus (cursor) is set in an iteration of the iterator (accordionPanel, dataTable, anything that loops over a List
), notify the managed bean via AJAX what the entity (item) I am currently in. So If there are 20 rows, and consequently that number of repeating forms, each representing an item
as the code exemplifies above, when I set my focus on one row's form, I would like to trigger a setter inside the managed bean setActiveEntity
that will point to the entity or its ID, whichever, that identifies the row I am in.