Advanced DataGrid with Model Data
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Model id="empModel"> <employees> <row> <employeeid>1</employeeid> <firstname>A</firstname> <lastname>B</lastname> <department>Marketing</department> </row> <row> <employeeid>2</employeeid> <firstname>C</firstname> <lastname>D</lastname> <department>Shipping</department> </row> </employees> </mx:Model> <mx:ArrayCollection id="employeeAC" source="{empModel.row}"/> <mx:AdvancedDataGrid id="employeeGrid" initialize="gc.refresh()"> <mx:dataProvider> <mx:GroupingCollection2 id="gc" source="{employeeAC}"> <mx:grouping> <mx:Grouping> <mx:GroupingField name="department"/> </mx:Grouping> </mx:grouping> </mx:GroupingCollection2> </mx:dataProvider> <mx:columns> <mx:AdvancedDataGridColumn dataField="department" headerText="Department" fontWeight="bold"/> <mx:AdvancedDataGridColumn dataField="firstname" headerText="First Name"/> <mx:AdvancedDataGridColumn dataField="lastname" headerText="Last Name"/> </mx:columns> </mx:AdvancedDataGrid> </mx:Application>