简体   繁体   中英

p:datatable multiple select with checkboxes. Rowtoggler triggers event

I have a datatable inside another datatable. The nested table I need to have a multiple selection checkboxes, a button to fire actionlistener and ap:rowToggler to show more data in row. The toggler and commandbutton works fine without the selection column in the table, but when I add this column the commandButton doesn't go to the backing bean, toggler on click doesn't work properly, and setSelected isn't called. Both throw a NP. I'm using 3.4.2 is this feature on newer releases only?

  SEVERE: FullAjaxExceptionHandler: An exception occurred during processing JSF ajax request. Error page '/error.xhtml' will be shown.
   java.lang.NullPointerException

Table

   <p:dataTable id="gro" var="g" value="#{requestBean.main.childRequest}" styleClass="veaGrid" 
     paginator="true" rows="1"    paginatorTemplate="{CurrentPageReport}"   > 

 <p:column>
      <p:ajaxStatus >  
        <f:facet name="start">  
            <p:graphicImage value="/resources/images/ajaxloadingbar.gif" />  
        </f:facet>  

        <f:facet name="complete">  
            <h:outputText value="" />  
        </f:facet>  
    </p:ajaxStatus> 
     <p:dataTable id="group" var="g2" value="#{g.groups}"  rowKey="#{g2.group_name}" selection="#{requestBean.selectedGroups}" >

            <p:column selectionMode="multiple" style="width:2%" />            

              <p:column headerText="#{g.systemCd} - Groups" style="width:25%" >  
                    #{g2.group_name}  
             </p:column>  
             <p:column style="width:2%">  
                View Users  <p:rowToggler  />   
              </p:column> 
             <p:rowExpansion>  

                <p:dataTable styleClass="veaGrid" var="g3" value="#{g2.group_members}"  sortOrder="descending" 
                    paginator="true" rows="10"  
                    paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                    filteredValue="#{requestBean.filteredMembers}">
                    <p:column filterBy="#{g3.first_name}">
                       <h:outputText value="#{g3.first_name}"/>
                    </p:column> 
                    <p:column filterBy="#{g3.last_name}">
                       <h:outputText value="#{g3.last_name}"/>
                    </p:column> 
                    <p:column filterBy="#{g3.signon}">
                      <h:outputText value="#{g3.signon}"/>
                    </p:column> 
               </p:dataTable>
            </p:rowExpansion>   

     </p:dataTable> 
          <center>  
            <p:commandButton id="continue" value="Continue"   actionListener="#{requestBean.saveGroups}"/>
          </center>   
     </p:column>           
 </p:dataTable> 

Found the problem.. I had the requestBean.selectedGroups set to

 ArrayList<Group>

I changed the property to

      Group[] 

and now everything is functional again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM