This content has been marked as final.
Show 2 replies
-
1. Re: selectBooleanCheckbox always false after paging in datas
ilya_shaikovsky May 31, 2007 7:44 AM (in response to bdouglas)Paste you sources please. I write simple example and the checks stores fine.
-
2. Re: selectBooleanCheckbox always false after paging in datas
bdouglas Jun 1, 2007 12:55 AM (in response to bdouglas)Hi,
I've been able to reproduce it in a trivial example: Here's the source for the action bean:package com.synyati.example; import java.util.List; /** * Example Action Bean. */ public interface ExampleAdminAction { /** * Get the entities. * @return the entities */ List<ExampleEntity> getEntities(); }
package com.synyati.example; import java.util.ArrayList; import java.util.List; import javax.ejb.Remove; import javax.ejb.Stateful; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Begin; import org.jboss.seam.annotations.Conversational; import org.jboss.seam.annotations.Destroy; import org.jboss.seam.annotations.Factory; import org.jboss.seam.annotations.FlushModeType; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; import org.jboss.seam.annotations.datamodel.DataModel; import org.jboss.seam.log.Log; import org.jboss.seam.log.Logging; /** {@inheritDoc} */ @Stateful @Name("exampleAdmin") @Conversational(ifNotBegunOutcome = "desktop") @Scope(ScopeType.CONVERSATION) // this is the default, but I'm choosing to show this explicitly public final class ExampleActionBean implements ExampleAdminAction { @DataModel private List<ExampleEntity> entityList; private Log log; /** * Default constructor. */ public ExampleActionBean() { log = Logging.getLog(ExampleActionBean.class); }; /** {@inheritDoc} */ @Factory ("entityList") @Begin(join = true, flushMode = FlushModeType.MANUAL) public List<ExampleEntity> getEntities() { log.trace("getEntities(): entry"); entityList = new ArrayList<ExampleEntity>(); for (int i = 0; i < 100; i++) { entityList.add(new ExampleEntity()); } log.trace("getEntities(): exit"); return entityList; } /** {@inheritDoc} */ @Destroy @Remove public void destroy() { log.trace("destroy(): entry/exit"); } }
And here's the dummy Entity:package com.synyati.example; import java.io.Serializable; import javax.persistence.Column; /** * Example entity (note: EJB entity annotations are removed for simplicity). */ public class ExampleEntity implements Serializable { private static final long serialVersionUID = 1L; private Boolean stateMandatory; private Boolean postcodeMandatory; /** * Default ctor. */ public ExampleEntity() { this.stateMandatory = true; this.postcodeMandatory = true; } /** * @return the stateMandatory */ public Boolean getStateMandatory() { return stateMandatory; } /** * @param stateMandatory the stateMandatory to set */ public void setStateMandatory(final Boolean stateMandatory) { this.stateMandatory = stateMandatory; } /** * @return the postCodeMandatory */ @Column(name = "postcode_mandatory", nullable = false) public Boolean getPostcodeMandatory() { return postcodeMandatory; } /** * @param postcodeMandatory the postCodeMandatory to set */ public void setPostcodeMandatory(final Boolean postcodeMandatory) { this.postcodeMandatory = postcodeMandatory; } /** {@inheritDoc} */ public String toString() { return "Country = [" + stateMandatory + ", " + postcodeMandatory + "]"; } }
And here's the xhtml:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.ajax4jsf.org/rich"> <ui:composition template="/template_maint.xhtml"> <ui:define name="maintenance"> <h:form id="entityAdminForm"> <h:dataTable id="entityGrid" var="entity" value="#{entityList}" rendered="#{not empty entityList}" rows="20"> <h:column> <f:facet name="header"><h:outputText value="Checkbox 1"/></f:facet> <h:selectBooleanCheckbox value="#{entity.stateMandatory}" onclick="setUpdatedGridRowBackground(this)"/> </h:column> <h:column> <f:facet name="header"><h:outputText value="Checkbox 2"/></f:facet> <h:selectBooleanCheckbox value="#{entity.postcodeMandatory}" onclick="setUpdatedGridRowBackground(this)"/> </h:column> <f:facet name="footer"><rich:datascroller for="entityGrid" maxPages="15"/></f:facet> </h:dataTable> </h:form> </ui:define> </ui:composition> </html>