Embedtable (Inline ) Table with rich:datatable
dave_m_burns Jan 29, 2008 12:17 PMHi I having problems creating an inline table with the rich:datatable and wonder if someone had a working example.
I don't want the current master/detail style as the included (detail) table has different columns from the master. What I'm trying to do is shown in the following oracle adf control (http://download-uk.oracle.com/docs/html/B25947_01/web_masterdetail006.htm)
I've even managed to get an included table within the rows although I had to use a blank rich:subTable to get the functionality. I'm now having problems getting the component id to how/hide the subtable with javascrit.
I'm thinking my whole approach is too complex and someonw has already got a simple solution for this :-).
In case you wish to see where I am here's the markup, feel free to completely ignore this as I think this is the wrong approach:
<?xml version="1.0" encoding="ISO-8859-1" ?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:c="http://java.sun.com/jstl/core" version="2.0"> <html xmlns="http://www.w3.org/1999/xhtml"> <ui:composition template="/layout.xhtml"> <ui:define name="title">Building Entity Detail</ui:define> <ui:define name="content"> <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" cellpadding="0" cellspacing="0" width="700" border="0" var="request1" value="#{embedTableBean.serviceRequests}"> <f:facet name="header"> <rich:columnGroup> <rich:column> <h:outputText value="1" /> </rich:column> <rich:column> <h:outputText value="2" /> </rich:column> <rich:column> <h:outputText value="3" /> </rich:column> <rich:column> <h:outputText value="4" /> </rich:column> <rich:column> <h:outputText value="6" /> </rich:column> <rich:componentControl event="onRowClick" for="bldListCol-#{request1.requestID}-YY" operation="hide" /> </rich:columnGroup> </f:facet> <rich:column> <h:outputText value="#{request1.requestID}"></h:outputText> </rich:column> <rich:column> <h:outputText value="#{request1.city}"></h:outputText> </rich:column> <rich:column> <h:outputText value="#{request1.city}" /> </rich:column> <rich:column> <h:outputText value="#{request1.city}" /> </rich:column> <rich:column> <h:outputText value="#{request1.requestID}" /> </rich:column> <rich:subTable onRowMouseOver="this.style.backgroundColor='#F8F8F8'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" cellpadding="0" cellspacing="0" var="request2" value="#{embedTableBean.serviceRequests}"> </rich:subTable> <rich:column colspan="5" id="bldListCol-#{request1.requestID}-xx" > <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" cellpadding="0" cellspacing="0" width="700" border="0" var="bld" value="#{request1.buildingsToServiceAsList}"> <f:facet name="header"> <rich:columnGroup> <rich:column> <rich:spacer /> </rich:column> <rich:column> <h:outputText value="a" /> </rich:column> <rich:column> <h:outputText value="b" /> </rich:column> <rich:column> <h:outputText value="c" /> </rich:column> </rich:columnGroup> </f:facet> <rich:column> <rich:spacer /> </rich:column> <rich:column> <h:outputText value="#{bld.building_id}"></h:outputText> </rich:column> <rich:column> <h:outputText value="#{bld.nme}"></h:outputText> </rich:column> <rich:column> <h:outputText value="#{bld.latitude}"></h:outputText> </rich:column> </rich:dataTable> </rich:column> </rich:dataTable> </ui:define> </ui:composition> </html> </jsp:root>
Also, is there a way to have a different header style in the inline table, e.g. can the facet="header" be something else?
Cheers
Dave