empty operator always returns false after a @DataModel refresh event
chawax Mar 27, 2008 12:21 PMHi,
I encounter problems using @DataModel annotation and <rich:datatable> tag. The empty operator doesn't work when refreshing the content after an event is raised ; it always returns false.
My @DataModel is as following :
@org.jboss.seam.annotations.datamodel.DataModel protected VOTacheValidationDemandeAbsence[] listeDemandesAbsenceAValider;
I have a @Factory method :
@org.jboss.seam.annotations.Factory(value="listeDemandesAbsenceAValider")
@javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRES_NEW)
@org.jboss.seam.annotations.Observer("listeDemandesAbsenceAValiderUpdated")
public void loadListeDemandesAbsenceAValider()
{
this.listeDemandesAbsenceAValider = getServiceAbsence().listerDemandesAbsenceAValider(this.actor.getId());
}
A method which raise the event to refresh the data model :
public void choisirTransitionTache(Long taskId, String transition)
throws java.lang.Exception
{
this.processHandler.followTransition(taskId, transition);
this.events.raiseEvent("listeDemandesAbsenceAValiderUpdated");
}
And part of the facelet :
<h:outputText value="#{messages['label.validationDemandesAbsence.empty']}" rendered="#{empty listeDemandesAbsenceAValider}"/>
<rich:dataTable value="#{listeDemandesAbsenceAValider}" var="task" rendered="#{not empty listeDemandesAbsenceAValider}">
<rich:column>
<a4j:commandLink
id="cmdDetail"
value="#{task.descriptionTache}"
action="#{validationDemandesAbsenceAction.detailDemandeAbsence(task.demandeAbsence)}"
reRender="wrapperDetailDemandeAbsence"
oncomplete="Richfaces.showModalPanel('panelDetailDemandeAbsence')" />
</rich:column>
<rich:column>
<h:outputText value="#{task.demandeAbsence.dateDemande}">
<s:convertDateTime type="date"/>
</h:outputText>
</rich:column>
<rich:column>
<s:button value="#{messages['label.demandeAbsence.accepter']}" action="#{validationDemandesAbsenceAction.choisirTransitionTache(task.idTache, 'ok')}" />
<s:button value="#{messages['label.demandeAbsence.refuser']}" action="#{validationDemandesAbsenceAction.choisirTransitionTache(task.idTache, 'nok')}" />
</rich:column>
</rich:dataTable>
It works well the first time. But when I call the method firing the refresh event, the empty operator always returns false while the list is empty (rowcount = 0 when I look at it in debug page). Same problem if the data model is a List. But if I stop using @DataModel and use @Out instead, no more problems ! So I think this is really a problem with @DataModel annotation.
Anyone has an idea what this problem comes from ?