0

如何访问组集合作为键值对。我需要访问 select 或提供的 group 的组特定元素。请看下面的代码

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Declarations>
    <!-- Place non-visual elements (e.g., services, value objects) here -->
    <fx:XMLList id="defaultColumns">
        <ROW>
            <NAME>DESCRIPTION_</NAME>
            <COLUMN_CAPTION>Description</COLUMN_CAPTION>
            <COLUMN_WIDTH>40</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@action</NAME>
            <COLUMN_CAPTION>Action</COLUMN_CAPTION>
            <COLUMN_WIDTH>20</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@err</NAME>
            <COLUMN_CAPTION>Error</COLUMN_CAPTION>
            <COLUMN_WIDTH>5</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General</GROUP_DESCRIPTION>
            <Color>#FF0000</Color>      
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@sql</NAME>
            <COLUMN_CAPTION>Sql</COLUMN_CAPTION>
            <COLUMN_WIDTH>1</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>DESCRIPTION_</NAME>
            <COLUMN_CAPTION>Description</COLUMN_CAPTION>
            <COLUMN_WIDTH>40</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General2</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@action</NAME>
            <COLUMN_CAPTION>Action</COLUMN_CAPTION>
            <COLUMN_WIDTH>20</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General2</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@err</NAME>
            <COLUMN_CAPTION>Error</COLUMN_CAPTION>
            <COLUMN_WIDTH>5</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General2</GROUP_DESCRIPTION>
            <Color>#FF0000</Color>      
            <OPTIONS/>
        </ROW>
        <ROW>
            <NAME>@sql</NAME>
            <COLUMN_CAPTION>Sql</COLUMN_CAPTION>
            <COLUMN_WIDTH>1</COLUMN_WIDTH>
            <GROUP_DESCRIPTION>0. General2</GROUP_DESCRIPTION>
            <OPTIONS/>
        </ROW>
    </fx:XMLList>
    <mx:GroupingCollection id="colGroup" source="{defaultColumns}">
        <mx:grouping>
            <mx:Grouping>
                <mx:GroupingField name="GROUP_DESCRIPTION"  />
            </mx:Grouping>
        </mx:grouping>
    </mx:GroupingCollection>
</fx:Declarations>
<fx:Script>
   <![CDATA[
protected function groupTabs_changeHandler(event:IndexChangedEvent):void
{
        var xmlList:XMLList=XMLList(colGroup.getRoot()[groupTabs.selectedChild.label]);
                Alert.show(xmlList.toXMLString());
}
 ]]>
 </fx:Script>
  <mx:TabNavigator id="groupTabs" borderStyle="solid" width="100%" initialize="{colGroup.refresh()}" change="groupTabs_changeHandler(event)">
   <mx:Repeater dataProvider="{colGroup.getRoot()}" id="t">
     <mx:VBox  label="{t.currentItem.GroupLabel.toString()}" width="100%"></mx:VBox>
  </mx:Repeater>
  </mx:TabNavigator>    
 </s:Application>

我想在任何可能的情况下访问组特定的 xmllist。

4

1 回答 1

0

请阅读显示分组数据它显示了如何操作组数据还阅读分组对象“分组数据的集合”

Grouping 类定义 AdvancedDataGrid 控件的数据提供程序中用于对数据进行分组的字段

在粘贴的代码中,t.currentItem包含Repeater控制下的组特定集合

希望有帮助

于 2012-04-21T10:20:18.883 回答