Hierarchical Advanced DataGrid row Column Grouping

Hierarchical Advanced DataGrid row Column Grouping

Postby haretu » Sun Jan 23, 2011 1:48 pm

Code: Select all
    <!-- dpcontrols/adg/SimpleHierarchicalADGGroupCol.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark">
    <fx:Script>
         
        import mx.collections.ArrayCollection;
        [Bindable]
        private var dpHierarchy:ArrayCollection = new ArrayCollection([
        {Region:"Southwest", children: [
            {Region:"Arizona", children: [
                {Territory_Rep:"Barbara Jennings", Actual:38865, Estimate:40000},
                {Territory_Rep:"Dana Binn", Actual:29885, Estimate:30000}]},
                {Region:"Central California", children: [
                    {Territory_Rep:"Joe Smith", Actual:29134, Estimate:30000}]},
                    {Region:"Nevada", children: [
                        {Territory_Rep:"Bethany Pittman", Actual:52888, Estimate:45000}]},
                        {Region:"Northern California", children: [
                            {Territory_Rep:"Lauren Ipsum", Actual:38805, Estimate:40000},
                            {Territory_Rep:"T.R. Smith", Actual:55498, Estimate:40000}]},
                            {Region:"Southern California", children: [
                                {Territory_Rep:"Alice Treu", Actual:44985, Estimate:45000},
                                {Territory_Rep:"Jane Grove", Actual:44913, Estimate:45000}]}
            ]}
        ]);
     
    </fx:Script>
    <mx:AdvancedDataGrid width="100%" height="100%">
        <mx:dataProvider>
            <mx:HierarchicalData source="{dpHierarchy}" />
        </mx:dataProvider>
        <mx:groupedColumns>
            <mx:AdvancedDataGridColumn dataField="Region" />
            <mx:AdvancedDataGridColumn dataField="Territory_Rep" headerText="Territory Rep" />
            <mx:AdvancedDataGridColumnGroup headerText="Revenues">
                <mx:AdvancedDataGridColumn dataField="Actual" />
                <mx:AdvancedDataGridColumn dataField="Estimate" />
            </mx:AdvancedDataGridColumnGroup>
        </mx:groupedColumns>
    </mx:AdvancedDataGrid>
</s:Application>
Attachments
HierarchicalAdvancedDataGridColumnGrouping.PNG
HierarchicalAdvancedDataGridColumnGrouping.PNG (12.61 KiB) Viewed 770 times
haretu
 
Posts: 132
Joined: Sat Jan 08, 2011 9:56 pm

Return to Adobe FLEX Flash

Who is online

Users browsing this forum: No registered users and 1 guest

cron