0

我想捕获标题单击事件,单击时,我想通过在每个级别动态添加 AdvancedDatgridColumnGroup 来拆分列。这可行吗?至少帮助我捕获标题单击事件。请不要建议 OLAP 。我想更多地探索高级数据网格选项。

<mx:AdvancedDataGrid x="6" y="4" id="adg0" designViewDataType="flat" width="947" height="357" click="summaryViewStack.selectedIndex = 1" fontFamily="Verdana" fontSize="10">



                    <mx:groupedColumns>
                    <mx:AdvancedDataGridColumn headerText="Cluster" dataField="label" />

                    <mx:AdvancedDataGridColumnGroup headerText="Revenue" >
                            <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                               <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                  <mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                  <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                  </mx:AdvancedDataGridColumnGroup>
                    <mx:AdvancedDataGridColumnGroup headerText="Headcount" >
                            <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                              <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                 <mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                 <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                 </mx:AdvancedDataGridColumnGroup>
                                    <mx:AdvancedDataGridColumnGroup headerText="Effort" >
                                    <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                                    <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                    <mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                    <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                    </mx:AdvancedDataGridColumnGroup>

                         </mx:groupedColumns>
                </mx:AdvancedDataGrid>
            </mx:Canvas>
            <mx:Canvas label="Accountwise Summary" width="100%" height="100%">
                <mx:AdvancedDataGrid x="6" y="4" id="adg1" designViewDataType="flat" width="947" height="357" click="summaryViewStack.selectedIndex = 1" fontFamily="Verdana" fontSize="10">
                   <mx:dataProvider>
                     <mx:ArrayCollection>
                        <mx:Object label="1800-Flowers" data1="20" data2="30" data3="40" data4="90" />
                        <mx:Object label="The Home Depot" data1="20" data2="30" data3="40" data4="90" />
                        <mx:Object label="Nielsen" data1="20" data2="30" data3="40" data4="90" />
                        <mx:Object label="Nokia" data1="20" data2="30" data3="40" data4="90" />
                     </mx:ArrayCollection>
                   </mx:dataProvider>


                    <mx:groupedColumns>
                    <mx:AdvancedDataGridColumn headerText="Account" dataField="label"/>

                    <mx:AdvancedDataGridColumnGroup headerText="Revenue" >
                            <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                               <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                  <mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                  <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                  </mx:AdvancedDataGridColumnGroup>
                    <mx:AdvancedDataGridColumnGroup headerText="Headcount" >
                            <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                              <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                 ><mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                 <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                 </mx:AdvancedDataGridColumnGroup>
                                    <mx:AdvancedDataGridColumnGroup headerText="Effort" >
                                    <mx:AdvancedDataGridColumn headerText="April" dataField="data1"/>
                                    <mx:AdvancedDataGridColumn headerText="May" dataField="data2"/>
                                    <mx:AdvancedDataGridColumn headerText="June" dataField="data3"/>
                                    <mx:AdvancedDataGridColumn headerText="Q1" dataField="data4"/>
                                    </mx:AdvancedDataGridColumnGroup></mx:groupedColumns>
                </mx:AdvancedDataGrid>
4

1 回答 1

1

听起来你想做的事情应该是可行的,但我认为这不会是微不足道的。

应该很容易创建一个headerRenderer组件,该组件调度您可以收听的点击事件。然后根据该点击即时重新创建分组。

您看过FlexMonster 数据透视表组件吗?我对此了解不多,但它似乎是为了解决您的问题而构建的。

于 2010-09-08T19:15:03.253 回答