5 Replies Latest reply on Sep 27, 2007 7:18 PM by pmuir

    checkboxes inside a clickable data table

    asookazian

      So does JSF/Seam support click data table with checkboxes inside?

      I need to implement a dataTable similar to that in the integration example in the Yuan source code (see pg. 149 of Yuan/Heute book).

      Addition is a couple of columns that are basically yes/no (boolean) checkboxes (one checkbox per column) that persists to the db table via JPA/entity bean.

      possible? or should I just allow the user to click edit command link for that row and change the data for that row on the next .xhtml page? thx.

        • 1. Re: checkboxes inside a clickable data table
          asookazian

          or how bout drop-downs? does dataTable, or similar, support this inside as well?

          • 2. Re: checkboxes inside a clickable data table
            shakenbrain

            I didn't use check boxes, but I don't see why that wouldn't work. I used a clickable image instead:

            <rich:column style="text-align: center">
             <f:facet name="header">
             <a:commandLink styleClass="headerLink" value="Active"
             actionListener="#{organizationFinder.sort}" reRender="organizationPanel">
             <f:attribute name="sortColumn" value="active"/>
             </a:commandLink>
             </f:facet>
             <a:commandLink action="#{organizationFinder.toggleActive(o)}" reRender="organizations">
             <s:fragment rendered="#{o.active}">
             <h:graphicImage value="/img/active.gif" border="0"/>
             </s:fragment>
             <s:fragment rendered="#{!o.active}">
             <h:graphicImage value="/img/inactive.gif" border="0"/>
             </s:fragment>
             </a:commandLink>
             </rich:column>


            @Begin @End
             public void toggleActive(Organization selectedOrganization) {
             Organization organization = entityManager.find(Organization.class, selectedOrganization.getId());
             organization.setActive(!organization.isActive());
             findOrganizations();
             }


            • 3. Re: checkboxes inside a clickable data table
              asookazian

              ok, I just hadn't seen an example of this yet. Is there one in the examples in seam distribution? thx for the reply.

              • 4. Re: checkboxes inside a clickable data table
                shakenbrain

                I'm not sure if there's an example or not. I forgot to mention though that drop-downs do work inside data tables.

                • 5. Re: checkboxes inside a clickable data table
                  pmuir

                  Yes, this works just fine in JSF with h:selectOneBoolean and h:dataTable