6 Replies Latest reply on May 14, 2009 3:06 PM by Tony Herstell

    Table and checkboxes

    Tony Herstell Master

      I have a rich:table.
      In a column is a checkbox.

      I want to check some checkboxes and then when I press the swaptimes buttons do the time swap in on the server of the checked rows.

      The call does happen to the server for

      eventsEntryController.swapTimesOfCompetitors(eachClass)

      but the checkboxes have not been set in the "model".




      <a4j:form>
       <rich:dataTable id="#{eachClass.id}table" columnClasses="table_entry text_important" width="100%"
       value="#{eachClass.competitorDetails}" var="eachEntry" rows="0"
       onRowMouseOver="this.style.backgroundColor='#F8F8F8'"
       rendered="#{eachClass.competitorDetails.size > 0}"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
       <f:facet name="header">
       <h:outputText value="Competitors (#{eachClass.competitorDetails.size})"/>
       </f:facet>
      ...
      
      
      <rich:column rendered="#{identity.loggedIn and s:hasRole('ADMINISTRATOR')}">
       <f:facet name="header">
       <h:outputText value="Swap Candidate" />
       </f:facet>
       <h:selectBooleanCheckbox value="#{eachEntry.swapCandidate}"/>
      </rich:column>
      
      ...
      
      
      </rich:dataTable>
       <center>
       <a4j:commandButton styleClass="general_form_button"
       rendered="#{identity.loggedIn and s:hasRole('ADMINISTRATOR')}"
       action="#{eventsEntryController.swapTimesOfCompetitors(eachClass)}"
       value="#{messages.general_button_swap_times}" type="submit">
       </a4j:commandButton>
       </center>
      </a4j:form>



      Entity:
      @SuppressWarnings("serial")
      @Entity
      @Name("competitorDetails")
      public class CompetitorDetails implements Serializable {
      ...
       @Transient
       private boolean swapCandidate;
      ...
       public boolean isSwapCandidate() {
       return swapCandidate;
       }
      
       public void setSwapCandidate(boolean swapCandidate) {
       this.swapCandidate = swapCandidate;
       }
      ...



      How do I get my checkboxes updated in the model?