3 Replies Latest reply on Nov 28, 2007 11:53 AM by Cristiane Yaguinuma

    problem with h:selectBooleanCheckbox in rich:dataTable

    Cristiane Yaguinuma Newbie

      I have the following rich:dataTable

      <rich:dataTable id="groupContacts" value="#{BackingBean.allContacts}" var="contact">
       <rich:column>
       <h:selectBooleanCheckbox value="true" />
       </rich:column>
       <rich:column>
       <h:outputText value="#{contact.name}" />
       </rich:column>
      </rich:dataTable>
      


      when the table is rendered, h:selectBooleanCheckbox is not checked. Does anyone know how to fix it? I'm using Richfaces 3.1.2.SP1 and Myfaces 1.1.5.

      Thanks,

      Cristiane Yaguinuma.

        • 2. Re: problem with h:selectBooleanCheckbox in rich:dataTable
          Ilya Shaikovsky Master

          known bug. Will works fine with EL binding.

          • 3. Re: problem with h:selectBooleanCheckbox in rich:dataTable
            Cristiane Yaguinuma Newbie

            Thanks Gena, it worked fine
            Now I have another problem when I need to change the value of h:selectBooleanCheckbox dynamically. Here is the code:

            <h:selectOneMenu id="selectGroup" valueChangeListener="#{ContactList.showGroupContacts}">
             <f:selectItems value="#{ContactList.selectGroupList}" />
             <a4j:support event="onchange" reRender="groupContactsPanel"/>
            </h:selectOneMenu>
            
            <a4j:outputPanel id="groupContactsPanel">
             <rich:dataTable id="groupContacts" value="#{ContactList.allContacts}" var="contact">
             <rich:column>
             <h:selectBooleanCheckbox value="#{contact.check}" />
             </rich:column>
             <rich:column>
             <h:outputText value="#{contact.name}" />
             </rich:column>
             </rich:dataTable>
            </a4j:outputPanel>
            


            The method showGroupContacts change the value of contact.check to true considering the contacts of the group chosen in h:selectOneMenu. However, when the datatable is rendered, h:selectBooleanCheckbox values do not change, even though they are changed by method showGroupContacts:
            public void showGroupContacts(ValueChangeEvent event) {
             String selectedGroup = (String) event.getNewValue();
            
             List groupContacts = (List) this.groups.get(selectedGroup);
             for (Iterator i = groupContacts.iterator(); i.hasNext();) {
             Contact c1 = (Contact) i.next();
             for (Iterator j = allContacts.iterator(); j.hasNext();) {
             Contact c2 = (Contact) j.next();
             if (c1.getId() == c2.getId())
             c2.setCheck(true);
             }
             }
            
            }
            

            Is there any problem with the code? How can I fix it?
            Thanks a lot for the help,
            Cristiane Yaguinuma.