In my setup I have a @Named
Bean, the class ObWithDate
is a @Entity
with a date field validFrom. Objects of this class are in a List<ObWithDate>
of the bean. I want to update the ObWithDate
immediately if a user changes a date. The p:dataTable
thus is showing several p:calendar
components:
<h:form id="fUser">
<p:dataTable id="dt" var="i" value="#{myBean.list}">
<p:column>
<p:calendar id="cValidFrom" value="#{i.validFrom}">
<p:ajax event="dateSelect" listener="#{myBean.up}" update=":fUser:dt"/>
</p:calendar>
</p:column>
</p:dataTable>
</h:form>
The code of the bean:
public void up(DateSelectEvent event)
{
logger.info("DateSelectEvent "+event.getDate());
// How to get the corresponding ObWithDate?
}
This is a subsequent question of Primefaces p:calendar with p:ajax value not updated (one step delay) but now targeting the concrete issue: How to get the corresponding list item in the ajax call inside the beans method?