Use HierarchicalData.childrenField to specify the name of the field that defines the hierarchy : AdvancedDataGrid « Grid « Flex






Use HierarchicalData.childrenField to specify the name of the field that defines the hierarchy

Use HierarchicalData.childrenField to specify the name of the field that defines the hierarchy
   


<?xml version="1.0"?>
<!--
Code from Flex 4 Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1) proper attribution to Adobe is given as the owner of the user guide; and 
  (2) any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:Script>
        
        import mx.collections.ArrayCollection;
        [Bindable]
        private var myHierarchicalData:ArrayCollection = new ArrayCollection([
        {Column1:"A", categories: [
            {Column1:"B", categories: [
                {Column2:"C", Value1:3, Value2:4},
                {Column2:"D", Value1:2, Value2:3}]},
                {Column1:"E", categories: [
                    {Column2:"F", Value1:2, Value2:3}]},
                    {Column1:"G", categories: [
                        {Column2:"H", Value1:5, Value2:4}]},
                        {Column1:"I", categories: [
                            {Column2:"J", Value1:3, Value2:4},
                            {Column2:"K", Value1:5, Value2:4}]},
                            {Column1:"O", categories: [
                                {Column2:"P", Value1:4, Value2:4},
                                {Column2:"Q", Value1:4, Value2:4}]}
            ]}
        ]);
      
    </mx:Script>
    <mx:AdvancedDataGrid width="100%" height="100%">
        <mx:dataProvider>
            <mx:HierarchicalData source="{myHierarchicalData}"
                childrenField="categories" />
        </mx:dataProvider>
        <mx:columns>
            <mx:AdvancedDataGridColumn dataField="Column1" />
            <mx:AdvancedDataGridColumn dataField="Column2"
                headerText="Column 2" />
            <mx:AdvancedDataGridColumn dataField="Value1" />
            <mx:AdvancedDataGridColumn dataField="Value2" />
        </mx:columns>
    </mx:AdvancedDataGrid>
</mx:Application>

   
    
    
  








Related examples in the same category

1.Hierarchical AdvancedDataGrid TreeColumnHierarchical AdvancedDataGrid TreeColumn
2.AdvancedDataGrid with four columnsAdvancedDataGrid with four columns
3.Using AdvancedDataGrid to show hierarchical dataUsing AdvancedDataGrid to show hierarchical data
4.Setting up the AdvancedDataGrid with dataField and headerTextSetting up the AdvancedDataGrid with dataField and headerText
5.AdvancedDataGrid and column groupingAdvancedDataGrid and column grouping
6.ArrayCollection and AdvancedDataGridArrayCollection and AdvancedDataGrid
7.Call invalidateList to refresh and apply the style to the AdvancedDataGridCall invalidateList to refresh and apply the style to the AdvancedDataGrid
8.Use styleFunction to apply style to AdvancedDataGrid based on conditionsUse styleFunction to apply style to AdvancedDataGrid based on conditions
9.Cut and paste cell for AdvancedDataGrid the TextArea control located at the bottom of the application:Cut and paste cell for AdvancedDataGrid the TextArea control located at the bottom of the application:
10.Allow Multiple Selection for AdvancedDataGridAllow Multiple Selection for AdvancedDataGrid
11.AdvancedDataGrid with With Hierarchical DataAdvancedDataGrid with With Hierarchical Data
12.AdvancedDataGrid with SummaryFieldAdvancedDataGrid with SummaryField
13.Fill data from XML to AdvancedDataGridFill data from XML to AdvancedDataGrid
14.Change column header for Hierarchical AdvancedDataGridChange column header for Hierarchical AdvancedDataGrid
15.Hierarchical AdvancedDataGrid CategoriesHierarchical AdvancedDataGrid Categories
16.Displaying hierarchical XML data and use it in AdvancedDataGridDisplaying hierarchical XML data and use it in AdvancedDataGrid
17.Group AdvancedDataGrid with MXML Default PropertiesGroup AdvancedDataGrid with MXML Default Properties
18.An AdvancedDataGrid that displays two summary fields, Min Actual and Max ActualAn AdvancedDataGrid that displays two summary fields, Min Actual and Max Actual
19.Summary Column with AdvancedDataGridSummary Column with AdvancedDataGrid
20.Summary AdvancedDataGrid with SummaryRow and SummaryField2Summary AdvancedDataGrid with SummaryRow and SummaryField2
21.implements the AdvancedDataGrid control shown in the previous figure:implements the AdvancedDataGrid control shown in the previous figure:
22.Regrouping AdvancedDataGridRegrouping AdvancedDataGrid
23.Advanced DataGrid DemoAdvanced DataGrid Demo
24.Advanced DataGrid with Model DataAdvanced DataGrid with Model Data
25.Advanecd DataGrid for NestedGroupsAdvanecd DataGrid for NestedGroups
26.Hierarchical Advanced DataGrid Column GroupingHierarchical Advanced DataGrid Column Grouping