Regroup GroupCollection
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:s="library://ns.adobe.com/flex/spark" creationComplete="handleCreationComplete();"> <mx:GroupingCollection2 id="groupingCollection"> <mx:source> <mx:Object city="A" state="C" region="E" /> <mx:Object city="B" state="D" region="F" /> </mx:source> <mx:grouping> <mx:Grouping> <mx:GroupingField name="state" /> </mx:Grouping> </mx:grouping> </mx:GroupingCollection2> <mx:Script> import mx.collections.Grouping; import mx.collections.GroupingField; private function handleCreationComplete():void { groupingCollection.refresh(); } private function createGrouping( field:String ):void { var groupingInst:Grouping = new Grouping(); groupingInst.fields = [new GroupingField( field )]; groupingCollection.grouping = groupingInst; groupingCollection.refresh(false); } </mx:Script> <mx:AdvancedDataGrid id="grid" dataProvider="{groupingCollection}"> <mx:columns> <mx:AdvancedDataGridColumn dataField="city" /> <mx:AdvancedDataGridColumn dataField="state" /> <mx:AdvancedDataGridColumn dataField="region" /> </mx:columns> </mx:AdvancedDataGrid> <mx:Button label="region group" click="{createGrouping('region')}" /> </mx:Application>