开发者

I'm having issues with my AdvancedDataGrid in Hierrachical view

开发者 https://www.devze.com 2023-02-27 00:32 出处:网络
I\'m having a strange issue with my AdvancedDataGrid.I have a pretty basic (no frills) XML file that I\'m pulling the data from and trying to create a hierarchical view in my ADG.It mostly works, but

I'm having a strange issue with my AdvancedDataGrid. I have a pretty basic (no frills) XML file that I'm pulling the data from and trying to create a hierarchical view in my ADG. It mostly works, but when my top level node only has one child I see the folder icon but no twistee to see the second level of data. If there's no second level or 2 or more it looks and works just fine. Has anyone run into this before or maybe I have it set up wrong? Here's some of the code:

XML:

<root>
<item item_id="4" title="First Document Title 33.1" author="Mark Pusateri" pubDate="4/10/2011">
    <tag name="Advisory" type="Service line"/>
    <tag name="GSS" type="Function/source"/>
    <tag name="Global" type="Area"/>
</item>
<item item_id="5" title="First Document Title 4" author="Mark Pusateri" pubDate="5/11/2011">
    <tag name="Americas" type="Area"/>
</item>
<item item_id="6" title="First Document Title 5" author="Mark Pusateri" pubDate="6/12/2012">
    <tag name="Japan" type="Area"/>
</item>
<item item_id="7" title="First Document Title 6" author="Mark Pusateri" pubDate="3/13/2009"/>
<item item_id="8" title="First Document Title 6.1" author="Mark Pusateri" pubDate="3/14/2011"/>
<item item_id="9" title="First Document Title 7" author="Mark Pusateri" pubDate="4/9/2011">
    <tag name="Americas" type="Area"/>
</item>

MXML:

<mx:AdvancedDataGrid id="mainADG" width="100%" height="100%">
        <mx:dataProvider>
            <mx:HierarchicalData source="{mainArrayColl}"
                                 childrenField="tag" />
        </mx:dataProvider>
        <mx:groupedColumns>
            <mx:AdvancedDataGridColumn headerText="Title" dataField="title"/>
            <mx:AdvancedDataGridColumn headerText="Author" dataField="author"/>
            <mx:AdvancedDataGridColumn headerText="Publication date" dataField="pubDate"/>

            <mx:AdvancedDataGridColumnGroup headerText="Tags" >
                <mx:AdvancedDataGridColumn headerText="Name" dataField="name"/>
                <mx:AdvancedDataGridColumn headerText="Type" dataField="type"/>
            </mx:开发者_如何学JAVAAdvancedDataGridColumnGroup>

        </mx:groupedColumns>
    </mx:AdvancedDataGrid>


Use @ symbol with Data-Field because all of these are attribute

<mx:AdvancedDataGrid id="mainADG" width="100%" height="100%">         
    <mx:dataProvider>             
        <mx:HierarchicalData source="{mainArrayColl}" />     
    </mx:dataProvider>         
    <mx:groupedColumns>           
        <mx:AdvancedDataGridColumn headerText="Title" dataField="@title"/>             
        <mx:AdvancedDataGridColumn headerText="Author" dataField="@author"/>             
        <mx:AdvancedDataGridColumn headerText="Publication date" dataField="@pubDate"/>              

        <mx:AdvancedDataGridColumnGroup headerText="Tags" >                 
            <mx:AdvancedDataGridColumn headerText="Name" dataField="@name"/>                 
            <mx:AdvancedDataGridColumn headerText="Type" dataField="@type"/>             
        </mx:AdvancedDataGridColumnGroup>
    </mx:groupedColumns>     
</mx:AdvancedDataGrid>

I removed childrenField="tag" b/c its works for me

hopes that helps

0

精彩评论

暂无评论...
验证码 换一张
取 消