h:selectBooleanCheckbox with selection in p:dataTable

UI Components for JSF
Post Reply
Turjakas
Posts: 48
Joined: 22 Jan 2010, 17:07

16 Feb 2010, 13:05

I would like to have additional checkboxes in p:dataTable columns to define boolean properties for the items,
but I also need single- and multi-row-selection in my dataTables.

Currently I'm trying to do something like this:

Code: Select all

                <p:dataTable
                    var="registry" value="#{registryBean.registries}"
                    paginator="#{registryBean.registries.size() > 5}" rows="5"
                    selection="#{registryBean.selectedRegistries}">
                  <p:column selectionMode="multiple">
                    <f:facet name="header">
                      <h:outputText value="Select" />
                    </f:facet>
                  </p:column>
                  <p:column>
                    <f:facet name="header">
                      <h:outputText value="Name" />
                    </f:facet>
                    <h:outputText value="#{registry.name}"/>
                  </p:column>
                  <p:column>
                    <f:facet name="header">
                      <h:outputText value="Prefer" />
                    </f:facet>
                    <h:selectBooleanCheckbox value="#{registry.preferred}" />
                  </p:column>
                </p:dataTable>
However, the problem is that p:dataTable seems to handle h:selectBooleanCheckbox the same way as the p:column selectionMode="multiple" -component, so that the rows get selected and unselected in a way that is not logical when clicking the checkbox in the "Preferred"-column.

Is there a way to combine row selection and checkboxes for other properties in p:dataTable?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Feb 2010, 13:24

I couldn't understand the problem, so when you check a checkbox in a non selection column, does it highlight the row, it shouldn't do that.

Turjakas
Posts: 48
Joined: 22 Jan 2010, 17:07

16 Feb 2010, 14:22

Yes. If I click the checkbox in the "Preferred" column, it will toggle the selection of the row. The corresponding property (registry.preferred) does get its value set correctly, so it is just the selection that is the problem.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

16 Feb 2010, 14:44

Can you please create a ticket in our issue tracker for this so we can have a look in detail?


cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

18 Feb 2010, 15:54

Thanks, we'll look into this.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 75 guests