Mega Code Archive

 
Categories / Flex / Grid
 

Use Labels from ArrayCollection as the column title for DataGrid

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" width="600" height="300" >     <mx:Script>                      import mx.collections.ArrayCollection;             [Bindable]             private var grocerySalesData:ArrayCollection = new ArrayCollection([                 {Grocer:"A", Category:"Y", Item:"Apple",  Q1:15, Q2:10},                 {Grocer:"B", Category:"X", Item:"Pork",   Q1:43, Q2:43}             ]);            </mx:Script>     <mx:DataGrid dataProvider="{grocerySalesData}" width="100%" height="100%" /> </mx:Application>