I am trying to create a datagrid within a advanced datagrid application
so I can provide additional details when expanding the row.  I found an
example online that use static array as the data source to accomplish
this:  See data array below:
  private var dp:Array= [         { name:"Krishna", total:100,
date:"01-Jan-2007",                  children:[ {
detail:[{amount:5},{amount:10},{amount:20},{amount:45}, {amount:30} ]} ]
},
          { name:"Sam", total:200, date:"21-Feb-2006",                
children:[
{detail:[{amount:15},{amount:25},{amount:35},{amount:55},{amount:70}]} ]
},
          { name:"Sameer", total:440, date:"16-July-2006",
children:[
{detail:[{amount:26},{amount:32},{amount:73},{amount:123},{amount:211}]}
] },
          { name:"Swaroop", total:300, date:"18-Aug-2006",
children:[
{detail:[{amount:159},{amount:235},{amount:135},{amount:155},{amount:70}\
]} ] }           ];
How do generate the same type of parent/child format from a PHP database
call?    There are two tables in the database the reference eachother. 
I want one to be parent and the other to be child.     Below is entire
code:
<?xml version="1.0" encoding="utf-8"?><mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"; layout="vertical">
<mx:Script>    <![CDATA[     import mx.collections.HierarchicalData;
private var dp:Array= [         { name:"Krishna", total:100,
date:"01-Jan-2007",                  children:[ {
detail:[{amount:5},{amount:10},{amount:20},{amount:45}, {amount:30} ]} ]
},
          { name:"Sam", total:200, date:"21-Feb-2006",                
children:[
{detail:[{amount:15},{amount:25},{amount:35},{amount:55},{amount:70}]} ]
},
          { name:"Sameer", total:440, date:"16-July-2006",
children:[
{detail:[{amount:26},{amount:32},{amount:73},{amount:123},{amount:211}]}
] },
          { name:"Swaroop", total:300, date:"18-Aug-2006",
children:[
{detail:[{amount:159},{amount:235},{amount:135},{amount:155},{amount:70}\
]} ] }           ];     ]]> </mx:Script><mx:AdvancedDataGrid
dataProvider="{new HierarchicalData(dp)}"   width="100%" height="100%" 
selectionMode="multipleRows"   sortableColumns="false"
variableRowHeight="true">               <mx:rendererProviders>
<mx:AdvancedDataGridRendererProvider columnIndex="0" dataField="detail"
renderer="chartItemRenderer"  columnSpan="0" />               
</mx:rendererProviders>          <mx:columns>          
<mx:AdvancedDataGridColumn dataField="name" headerText="Name"
width="100"/>           <mx:AdvancedDataGridColumn dataField="total"
headerText="Total" width="30"/>           <mx:AdvancedDataGridColumn
dataField="children" headerText="Variation" 
itemRenderer="lineChartRenderer" width="300"/>          
<mx:AdvancedDataGridColumn dataField="date" headerText="Date"
width="100"/>       </mx:columns>       </mx:AdvancedDataGrid>
</mx:Application>

Reply via email to