DataTable problems when using SubTable
rajeshv7 May 17, 2007 3:25 AMI have situation where I need to have a subtable inside a datatable and this subtable form a column of the datatable and there are other columns as well.
For example, lets assume that I want a report showing the details of all orders made by different customers and each order has individual order item details.
The outermost table has two colums one is customer name and the other is OrderDetails.
The OrderDetails column has two columns one lists all the order items in this order and the other column shows the delivery address. Noet that that this second column should have a row span equal to no of other items. As the customer can have one or more orders this repeats over.
I have several probelms. I name a few here
1. With the following code the after adjusting the first subtable appeared alright but the columns after the subtable goes to the next row. But I want it in the same row.
2. I though the rowSpan for customer for uinstance, should be equal to number of orders + 1 for the column header. But that doesn't quite seem to work and I have to add few extra.
3. With IE the table looks Ok but with fire fox I see additional lines in due to the subtable
4. Basically the whole table looks our of order.
My xhtml code is
<rich:dataTable var="customer" value="#{reports.customerList}">
<rich:column rowspan="#{customer.noOfOrders + 1}">
<f:facet name="header">
<h:outputText value="#{messages.label_CustomerName}"/>
</f:facet>
<h:outputText value="#{customer.name}"/>
</rich:column>
<rich:column colspan="5">
<f:facet name="header">
<h:outputText value="#{messages.label_OrderDetails}"/>
</f:facet>
<ui:repeat var="order" value="#{customer.orders}" >
<rich:column>
<rich:subTable var="orderItem" value="#{order.orderItems}" >
<rich:column>
<f:facet name="header">
<h:outputText value="#{messages.label_ItemPrice}"/>
</f:facet>
<h:outputText value="#{orderItem.price}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" groupingUsed="true"/>
</h:outputText>
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="#{messages.label_ItemName}"/>
</f:facet>
<h:outputText value="#{order.name}"/>
</rich:column>
</rich:subTable>
</rich:column>
<rich:column rowspan="#{order.noOfOrderItems + 1}">
<f:facet name="header">
<h:outputText value="#{messages.label_DeliveryAddress}"/>
</f:facet>
<h:outputText value="#{order.deliveryAddress}"/>
</rich:column>
</ui:repeat>
</rich:column>
</rich:dataTable>
Does anybody have any experience dealing with such a scenario with the datatable?
Rajesh