Collapsing
A p:dataTable can be set as collapsible simply by applying the styleClass jeesl-datatable-collapsible . The default behaviour has the table initially closed but it can be set to expanded by additionally adding the styleClass jeesl-active .
<p:dataTable var="r"
value="#{tableRowSelectionBean.rows}"
rowKey="#{r.id}"
styleClass="jeesl-datatable jeesl-datatable-collapsible jeesl-active">