I'm trying to expand a dataTable by adding another dataTable inside the first. The idea is that I expand a row (service info) to display all customers of this service. These customers should be displayed in a second dataTable.
The sdh.sd.id is always null when given to the getCustomersOfService method (providerStart.getCustomersOfService(sdh.sd.id)).
Therefore, I preselect the row before clicking on the rowToggler. The interesting thing is that this most of the time does not work but sometimes it does. Most of the time I get a NullPointerException because the selection does not work (i.e. the backing bean is not set. I also set a background which was not reached). If I remove the facet expansion, the selection works fine.
Code: Select all
<p:dataTable id="publishedServicesDataTable" var="sdh"
value="#{providerStart.publishedServices}"
selection="#{providerStart.selectedService}"
selectionMode="single" update="proxy">
<p:column style="width:16px">
<p:rowToggler />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{sdh.sd.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Service Name" />
</f:facet>
<h:outputText value="#{sdh.name}" />
</p:column>
<f:facet name="expansion">
<p:dataTable id="customersOfService" var="cust"
value="#{providerStart.getCustomersOfService(sdh.sd.id)}">
<p:column>
<f:facet name="header">
<h:outputText value="ID" />
</f:facet>
<h:outputText value="#{cust.id}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Organisation" />
</f:facet>
<h:outputText value="#{cust.organization.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="Contact Person" />
</f:facet>
<h:outputText value="#{cust.firstname} #{cust.lastname}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="E-Mail" />
</f:facet>
<h:outputText value="#{cust.email}" />
</p:column>
</p:dataTable>
</f:facet>
</p:dataTable>
<p:dialog id="proxy" rendered="false" />
Do you have any advise how I could circumvent the problem?
I'm using Primefaces 2.2 RC2 and run it on JBoss 6 (JSF 2; Mojarra 2.0.3).
Best,
HalloSchwester