[jboss-user] [JBoss Seam] - EntityHome, ajax4JSF and Pagination

gledson.rabelo do-not-reply at jboss.com
Tue Apr 24 14:17:47 EDT 2007


Hi,

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 go to the next page (>), the listPanel is rerendered and the checkboxs should be cleaned for the new entities of current page. 

But when I selected one checkbox and go to the next page, it remains checked in the next page.

And when I clicked in the Remove button ("Excluir") and I'm in the middle page, the ids of the first are sended for the removeChecked operation. 

My Code is listed  below.

Please, Could somebody help me? 



  | 
  | <a4j:form>	
  | 	...
  | 
  | 	<a4j:outputPanel id="listPanel" ajaxRendered="true" layout="block">
  | 
  | 		<!-- search results -->
  | 
  | 		<rich:dataTable value="#{questionarios.resultList}" var="questionario"
  | 			id="table">
  | 			<!--  Table Header -->
  | 			<f:facet name="header">
  | 				<rich:columnGroup>
  | 					<rich:column>
  | 						<h:outputText value="Seleção" />
  | 					</rich:column>
  | 					<rich:column>
  | 						<h:outputText value="Id" />
  | 					</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>
  | 			<!--  Table Rows -->
  | 			<rich:column>
  | 				<h:selectBooleanCheckbox value="#{questionarioHome.selection[questionario.idQuestionario]}"/>
  | 			</rich:column>
  | 			<rich:column>
  | 				<h:outputText value="#{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&aacute; question&aacute;rios para seram exibidos."
  | 			rendered="#{empty questionarios.resultList}" class="message" />
  | 
  | 		<div class="tableControl">
  | 		
  | 			<h:outputText value="Total de Registros: ${questionarios.resultCount}" /> 
  | 			
  | 			<a4j:commandLink value="&lt;&lt;" reRender="listPanel" rendered="#{questionarios.previousExists}">
  | 				<f:param name="firstResult" value="0" />
  | 				<f:param name="querySorting" value="#{questionarios.order}" />
  | 			</a4j:commandLink> 
  | 			
  | 			<a4j:commandLink value="&lt;" reRender="listPanel" 	rendered="#{questionarios.previousExists}">
  | 				<f:param name="firstResult" value="#{questionarios.previousFirstResult}" />
  | 				<f:param name="querySorting" value="#{questionarios.order}" />
  | 			</a4j:commandLink> 
  | 			
  | 			<a4j:commandLink value="&gt;" reRender="listPanel" rendered="#{questionarios.nextExists}">
  | 				<f:param name="firstResult" value="#{questionarios.nextFirstResult}" />
  | 				<f:param name="querySorting" value="#{questionarios.order}" />
  | 			</a4j:commandLink> 
  | 	
  | 			<a4j:commandLink value="&gt;&gt;" reRender="listPanel" 	rendered="#{questionarios.nextExists}">
  | 				<f:param name="firstResult" value="#{questionarios.lastFirstResult}" />
  | 				<f:param name="querySorting" value="#{questionarios.order}" />
  | 			</a4j:commandLink>
  | 		</div>
  | 		
  | 		<div class="actionButtons">
  | 			<a4j:commandLink reRender="listPanel" value="Excluir" action="#{questionarioHome.removeChecked}"/>
  | 		</div>
  | 		
  | 	</a4j:outputPanel>
  | </a4j:form>
  | 
  | 
  | 


  | 
  | @Name("questionarioHome")
  | public class FramexEntityHome<E> extends EntityHome<E> {
  | 
  | 	private static final long serialVersionUID = -1322828158520981636L;
  | 
  | 	@Override
  | 	public Object getId() {
  | 		return super.getId();
  | 	}
  | 	
  | 	Map<Object, Boolean> selection = new HashMap<Object, Boolean>();
  | 
  | 	public Map<Object, Boolean> getSelection() {
  | 		return selection;
  | 	}
  | 
  | 	public void setSelection(Map<Object, Boolean> selection) {
  | 		this.selection = selection;
  | 	}
  | 
  | 	public void removeChecked() {
  | 		System.out.println("CALL REMOVE CHECKED"); 
  | 		if (selection != null) {
  | 			System.out.println("### SIZE ###" + selection.keySet().size());
  | 			for (Object id : selection.keySet()) {
  | 				System.out.println("---> " + id + ":" + selection.get(id));
  | 			}
  | 		} 
  | 	}
  | }
  | 
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4040301#4040301

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4040301




More information about the jboss-user mailing list