views:

62

answers:

1

I want to capture the header click event and on click , i want to split the columns ,by adding the AdvancedDatgridColumnGroup dynamicaly at each level.Is it feasible? Atleast help me with capturing the header click event.Please do not suggest OLAP .I want to explore the advanced datagrid option more.

<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>
+1  A: 

It sounds like what you want to do should be feasible, but I don't think it'll be trivial.

It should be pretty easy to create a headerRenderer component which dispatches a click event that you can listen to. Then re-create the grouping on the fly based on that click.

Have you looked at the FlexMonster Pivot Table Component? I don't know much about it, but it seems to have been built to solve your issue.

www.Flextras.com