I have a rich:calendar component in a datatable:
<rich:column id="last_#{row.index}" >
<rich:calendar id="lcal_#{row.index}"
value="#{_obj.list[row.index].lastTaught}">
<a4j:support event="onchanged"
action="#{_obj.list[row.index].setBooleanDateHasBeenChanged}"
ajaxSingle="true" reRender="last_#{row.index}" />
</rich:calendar>
</rich:column>
When a user changes the date I need to set a field to true (I need to know what row was changed for db update later, I want to update a bunch of rows at once):
/**
* when someone changes the last taught field, set has been edited to true
*/
public void resetHasBeenEdited(){
this.hasBeenEdited = true;
}
When I change the date the setBooleanDateHasBeenChanged method is called and the _obj.list is updated in the backing bean, but when I examine _obj after the rerender, the hasBeenEdited field does not reflect the change.
I tried using a valueChangeListener (changed method signature to match):
<rich:column id="last_#{row.index}" >
<rich:calendar id="lcal_#{row.index}"
value="#{_obj.list[row.index].lastTaught}"
valueChangeListener="#{_obj.list[row.index].setBooleanDateHasBeenChanged}">
<a4j:support event="onchanged"
ajaxSingle="true" reRender="last_#{row.index}" />
</rich:calendar>
</rich:column>
But then setBooleanDateHasBeenChanged doesn't even run. How do I get an action to update the backing bean AND reflect that change in the rerendered JSF model? I'm using JSF1.2, RF3.3 and Seam2.2.
I tried a bunch of different configurations, but what finally worked was getting rid of ajaxSingle and reRender:
<rich:column id="last_#{status.index}"
<rich:calendar value="#{_obj.list[row.index].lastTaught}" >
<a4j:support event="onchange"
actionListener="#{_obj.list[row.index].resetTaughtHasBeenEdited()}"/>
</rich:calendar>
</rich:column>
The reRender action would just reset the displayed value to its previous setting and ajaxSingle wouldn't update the model.