reRender, update Model and commandLink
gledson.rabelo Apr 24, 2007 11:40 PMHi,
I'm using the Seam EntityHome and Ajax4JSF for developing ajax enabled CRUDs with pagination.
The data table has checkboxs that the user can select to delete many entities.
When I clicked in the Delete Button ("Excluir") the value of checkboxs should be updated in model, the method #{questionarioHome.removeChecked} should be cleaned called and the form should be cleaned reRendered returning to first page of data table, respectively .
But, the values returned for #{questionarioHome.removeChecked} method are the values of first page and not of the current page.
I thinking that the Rerender operation is being executed before the update of the model and the call the method #{questionarioHome.removeChecked}.
I tried to use immediate=true in the commandLink, but the call of method #{questionarioHome.removeChecked} is executed before the update of the model and I don't get the selected values.
I am making made a mistake?
Please, could somebody help me?
My code is listed below:
<a4j:form> <a4j:outputPanel id="listPanel" ajaxRendered="true" layout="block"> <!-- search results --> <rich:dataTable value="#{questionarios.resultList}" var="questionario" id="table"> <f:facet name="header"> <rich:columnGroup> <rich:column> Seleção </rich:column> <rich:column> <a4j:commandLink value="-" reRender="listPanel"> <f:param name="querySorting" value="descricao" /> </a4j:commandLink> <h:outputText value="Descrição" /> </rich:column> <rich:column> <a4j:commandLink value="-" reRender="listPanel"> <f:param name="querySorting" value="exercicio" /> </a4j:commandLink> <h:outputText value="Exercício" /> </rich:column> </rich:columnGroup> </f:facet> <rich:column> <h:selectBooleanCheckbox value="#{questionarioHome.selection[questionario.idQuestionario]}" /> </rich:column> <rich:column> <s:link view="/viewQuestionario.xhtml" value="#{questionario.descricao}"> <f:param name="questionarioId" value="#{questionario.idQuestionario}" /> </s:link> </rich:column> <rich:column> <h:outputText value="#{questionario.exercicio}" /> </rich:column> </rich:dataTable> <h:outputText value="Não há questionários para seram exibidos." rendered="#{empty questionarios.resultList}" class="message" /> <div class="tableControl"><h:outputText value="Total de Registros: ${questionarios.resultCount}" /> <!-- Pagination Buttons --> <a4j:commandLink value="<<" reRender="listPanel" ajaxSingle="true" rendered="#{questionarios.previousExists}"> <f:param name="firstResult" value="0" /> <f:param name="querySorting" value="#{questionarios.order}" /> </a4j:commandLink> <a4j:commandLink value="<" reRender="listPanel" ajaxSingle="true" rendered="#{questionarios.previousExists}"> <f:param name="firstResult" value="#{questionarios.previousFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </a4j:commandLink> <a4j:commandLink value=">" reRender="listPanel" ajaxSingle="true" rendered="#{questionarios.nextExists}"> <f:param name="firstResult" value="#{questionarios.nextFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </a4j:commandLink> <a4j:commandLink value=">>" reRender="listPanel" ajaxSingle="true" rendered="#{questionarios.nextExists}"> <f:param name="firstResult" value="#{questionarios.lastFirstResult}" /> <f:param name="querySorting" value="#{questionarios.order}" /> </a4j:commandLink></div> <div class="actionButtons"> <!-- Delete Button --> <a4j:commandLink action="#{questionarioHome.removeChecked}" value="Excluir"> </a4j:commandLink> </div> </a4j:outputPanel> </a4j:form>