title: Primefaces DataTable with SubTable and multiple selection
body: <p>I would like to have a table of bookings grouped by clients. From this table the user shall be able to select multiple booking for billing. So I am trying to use a SubTable for the grouping, however, I am unsure how to realize to selection functionality. Apparently the subtable doesn't allow the selection attribute and if I set the selection attribute on the parent DataTable I don't know how to choose the rowKey.</p>
  
  <p>That is my try:</p>
  
  <pre><code>&lt;p:dataTable style="border: 0px;" value='#{clientController.allClients}'
               var='client' rowKey="#{item.id}"  selectionMode="multiple"
               selection="#{bookingController.bookingsToBill}"&gt;
    &lt;p:subTable value='#{client.billableBookings}' var='item'&gt;
      &lt;f:facet name="header"&gt; 
          &lt;h:outputText style="font-weight:bold;" value="#{client.name}" /&gt;
      &lt;/f:facet&gt;
      &lt;p:column&gt;
          &lt;f:facet name="header"&gt;
              &lt;h:outputText value="Booking"/&gt;
          &lt;/f:facet&gt;
          &lt;h:outputText value="#{item.title}"/&gt;
      &lt;/p:column&gt;
    &lt;/p:subTable&gt;
  &lt;/p:dataTable&gt;
  </code></pre>
  
  <p>Well, this results in the following error when submitting the selection:</p>
  
  <pre><code>java.lang.NullPointerException
     java.lang.reflect.Array.newArray(Native Method)
     java.lang.reflect.Array.newInstance(Array.java:52)
     org.primefaces.component.datatable.DataHelper.decodeMultipleSelection(DataHelper.java:238)
     org.primefaces.component.datatable.DataHelper.decodeSelection(DataHelper.java:224)
     org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:64)
     javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
     javax.faces.component.UIData.processDecodes(UIData.java:1162)
     org.primefaces.component.datatable.DataTable.processDecodes(DataTable.java:531)
     javax.faces.component.UIForm.processDecodes(UIForm.java:225)
     javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
     javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
     javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
     com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
     com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
     com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
     javax.faces.webapp.FacesServlet.service(FacesServlet.java:409)
  </code></pre>
  
  <p>Is multiple selection supported for DataTables with SubTables? If so, how to do it right? If not, which way would you suggest to achieve a similar result?</p>
  
  <p>I'm using: Primefaces 3.1.1 - Mojarra JSF 2.1 - Tomcat 6.0.14</p>