You need to sign in to do that
Don't have an account?
kdmr
Nesting a datatable
Hi,
I am trying to create a tree structure on a visualforce page. Is it possible to nest one datatable into another datatable. Is there and expample for such a thing.
Thanks
KD
I've had success nesting dataTables 1 level. My solution is based on a SOQL Query with an in-line relationship query.
NOTE: Try true/false for the 'breakBefore' attribute in apex:column to see the different behaviors.
<apex:dataTable value="{!quotes}" var="q">
<apex:column value="{!q.quote_number__c}" />
<apex:column value="{!q.quote_date__c}" />
<apex:column breakBefore="true">
<apex:dataTable value="{!q.QuoteLines__r}" var="qLine">
<apex:column headerValue="Line #" value="{!qLine.line_number__c}" />
<apex:column headerValue="P/N" value="{!qLine.part_number__c}" />
</apex:dataTable>
</apex:column>
</apex:dataTable>
Here's the SOQL: (a quote has many quote lines)
List<Quote__c> quotes = [Select id, name, quote_number__c, quote_date__c, (SELECT line_number__c, part_number__c from QuoteLines__r) from Quote__c];
You cannot go additional levels using a SOQL statement; however, you may be able to go deep (like a tree) using your own custom class for the tree's data source.