Note that there are some explanatory texts on larger screens.

plurals
  1. POprimeFaces LazyLoading datatable inside another dataTable and rowExpansion
    text
    copied!<p>I am using primeFaces 3.4.2 and have implemented Lazy Loading Data Table with sorting, filtering. I am trying to embed another datatable inside the above mentioned data table.</p> <p>I have used row expansion and row toggler for the above purpose.</p> <p>My scenerio is something like this</p> <pre><code>public class Customer { @Id private Long id; private String name; private String email; @JoinColumn(unique = true, name = "Cust_Details_Id" ) @OneToOne(cascade = CascadeType.ALL) private CustomerDetails customerDetails; } public class CustomerDetails { @Id private Long cdId; @OneToOne(mappedBy = "customerDetails", cascade = CascadeType.ALL) private Customer customer; @OneToMany(mappedBy = "customerDetails", cascade = CascadeType.ALL) private List&lt;TypeA&gt; listOfTypeA = new ArrayList&lt;TypeA&gt;(); @OneToMany(mappedBy = "customerDetails", cascade = CascadeType.ALL) private List&lt;TypeB&gt; listOfTypeB = new ArrayList&lt;TypeB&gt;();; } public classTypeA { @Id private Long typeAId; @ManyToOne(cascade = CascadeType.ALL) private MeasurementDetails measurementDetails; // Around 10-12 fields to store its details } public classTypeB { @Id private Long typeBId; @ManyToOne(cascade = CascadeType.ALL) private MeasurementDetails measurementDetails; // Around 12-15 fields to store its details } </code></pre> <p>//I am using LazyLoading like below code</p> <pre><code>&lt;p:dataTable id="dataTable" var="customer" value="#{customerController.lazyModel}" styleClass="userDataTableStyle" paginator="true" rows="10" selection="#{customerController.selctedCustomers}" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" lazy="true" rowsPerPageTemplate="10,15,50" &gt; &lt;f:facet name="header"&gt;Customer List&lt;/f:facet&gt; &lt;p:column&gt; &lt;p:rowToggler id="rowToggler" /&gt; &lt;/p:column&gt; &lt;p:column selectionMode="multiple" style="width:18px" /&gt; &lt;p:column headerText="First Name" sortBy="#{customer.firstName}" filterBy="#{customer.firstName}"&gt; &lt;f:facet name="header"&gt; &lt;p:outputLabel value="First Name" /&gt; &lt;/f:facet&gt; &lt;p:commandLink value="#{customer.firstName}" update=":customerDetailForm:display" oncomplete="custDialog.show()" title="View"&gt; &lt;f:setPropertyActionListener value="#{customer}" target="#{customerController.selectedCustomer}" /&gt; &lt;/p:commandLink&gt; &lt;/p:column&gt; &lt;!-- Other Columns --&gt; &lt;!-- I want to embed another data here but based on the previous selected customers row Toggle --&gt; &lt;p:rowExpansion id="expand" rendered="true" &gt; &lt;p:dataTable id="dataTableInner" var="cust" value="#{customerController.selctedCustomers}" styleClass="userDataTableStyle" lazy="true" rowsPerPageTemplate="10,15,50"&gt; &lt;f:facet name="header"&gt; Customer Details &lt;/f:facet&gt; &lt;p:column headerText="Customer Details " sortBy="#{customer.customerDetails}" &gt; &lt;f:facet name="header"&gt; &lt;p:outputLabel value="Customer Details" /&gt; &lt;/f:facet&gt; &lt;p:outputLabel value="#{customer.customerDetails.customerId}" /&gt; &lt;/p:column&gt; &lt;p:column headerText="Mas ccc" &gt; &lt;f:facet name="header"&gt; &lt;p:outputLabel value="Date" /&gt; &lt;/f:facet&gt; &lt;p:outputLabel value="#{customer.customerDetails.TypeA[0]}" /&gt; &lt;!-- Example --&gt; &lt;/p:column&gt; &lt;/p:dataTable&gt; &lt;!-- Inner datatable --&gt; &lt;/p:rowExpansion&gt; &lt;/p:dataTable&gt; &lt;!-- Outer datatable --&gt; </code></pre> <p><br/> Questions <br/> 1. How do I know which customer has been "Row Toggeled" not via Checkbox which I am using for delete <br/> 2. I want to display a dataTable of TypeA and TypeB (if data is present in the list), it gets triggered upon row toggler<br/> 3. I am maintaining customerDetails class to keep track of lists of TypeA and TypeB, Shall I remove this class and simply stick the Lists into Customer Class itself?<br/></p> <p>// It can have Zero or One TypeA list, similarly for TypeB too, in Customer Details Class<br/> Please Help me if My design is incorrect and provide some pointers so that I can get this to working</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload