I have again :-( a weird problem with a p:calendar inside a p:dataTable:
<h:form id="fId">
<p:dataTable var="cum" value="#{myBean.list}">
<p:column>
<p:calendar value="#{cum.validFrom}">
<p:ajax update=":fId" event="dateSelect" listener="#{myBean.upDateCum}"/>
</p:calendar>
</p:column>
<p:column>
<h:outputText value="#{cum.validFrom}"/>
</p:column>
</p:dataTable>
</h:form>
The method in the bean is getting the correct element where the update occurs ( JSF p:calendar in p:dataTable: How to get the row of p:ajax dateSelect event ) then the date in the element is updated and list gets reordered. The correct ordering and updating can be verified in the bean at the end of the upDateCum method:
public void upDateCum(DateSelectEvent event)
{
// Logging Before (iteration over list, debugging id and date)
// set date with provided date from event
// Logging After (iteration over list, debugging id and date)
}
20:53:10,455 INFO [myBean] Before id:148 -- 2012-04-15
20:53:10,456 INFO [myBean] Before id:141 -- 2012-04-10
20:53:10,456 INFO [myBean] Before id:147 -- 2012-04-05
20:53:10,823 INFO [myBean] After id:147 -- Fri Apr 20 00:00:00 CEST 2012
20:53:10,823 INFO [myBean] After id:148 -- 2012-04-15
20:53:10,823 INFO [myBean] After id:141 -- 2012-04-10
But the row of the table in which the change occurs contains always the value which actually was changed there (see image), but now should belong to another row (because of reordering).
The date in the third row (object.id=147) was changed from 05.04.12 to 20.04.12. After the update the changed date is in the first position (which is ok). But the third row does not contain the unchanged date of id=141, it holds the new data (20.04.12):
Interestingly: The h:outputText also contains the wrong date. I only can assume that the p:calendar is overriding the value after the beans method is executed.