DataTable with checkbox multiple selection not firing

UI Components for JSF
Post Reply
crazy.8
Posts: 13
Joined: 18 Feb 2011, 18:37

11 Oct 2011, 22:28

I have the following code and the backing bean methods for selection never get called, is there a way to make this an instant ajax event that updates a list every time you select/un-select a check box?

Code: Select all

<p:dataTable id="currEvent" var="currEvent" value="#{emailController.events}" paginator="false"
                                             selectionMode="multiple"
                                             scrollable="true" height="500"
                                             resizableColumns="true"
                                             dynamic=""
                                             selection="#{emailController.selectedEvents}">
                                    <f:facet name="header">
                                        Current Events
                                        <p:commandButton id="submit" update="displayMulti" value="Get Registrants" oncomplete="multiEventDialog.show()"/>
                                    </f:facet>
                                    <p:column selectionMode="multiple"/>
                                    <p:column headerText="Begin Date" style="width:105px">
                                        #{currEvent.begDate}
                                    </p:column>
                                    <p:column headerText="End Date" style="width:105px">
                                        #{currEvent.endDate}
                                    </p:column>
                                    <p:column headerText="Location Name" style="width:295px">
                                        #{currEvent.name}
                                    </p:column>

                                </p:dataTable>
Backing Bean snipplet:

Code: Select all

private EventObj[] seleectedEvents;
/**
     * @return the selectedEvents
     */
    public EventObj[] getSelectedEvents() {
        return selectedEvents;
    }

    /**
     * @param selectedEvents the selectedEvents to set
     */
    public void setSelectedEvents(EventObj[] selectedEvents) {
        this.selectedEvents = selectedEvents;
        
    }

robert.m
Posts: 226
Joined: 07 Dec 2010, 22:52
Location: Salzburg/Austria

11 Oct 2011, 23:16

Which version of PrimeFaces are you using? Also have a look at viewtopic.php?f=3&t=1194 to see what information you should include in your posts

Billy
Posts: 1
Joined: 12 Oct 2011, 01:51

12 Oct 2011, 02:04

In Tag:
<p:commandButton id="submit" update="displayMulti" value="Get Registrants" oncomplete="multiEventDialog.show()"/>
plase insert the property --> type="button"
or don't insert it and use a actionListener. I can't get what you're trying to do exactly. Maybe further discriptions are helpful.

update="displayMulti" --> does a container with id displayMulti exist?

Furthermore in my opinion you should decide whether do make selection by rowClick or by checkoxes.
JBoss 7.0.0, PrimeFaces 3.0.M3, JSF 2.0, EJB 3.1, JPA 2.0 with Hibernate

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

03 Jan 2012, 18:59

rowKey is missing!!! (Cost me 6 hours to find that out myself!!!. Showcases does not point this out, only the docs! :-(:-(:-(

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 45 guests