I think I would create a composite component with a header and either a List or a VBox and a repeater. Instead of using DataGrid
Tracy Spratt, Lariat Services, development services available _____ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Alex Harui Sent: Thursday, January 21, 2010 12:10 AM To: flexcoders@yahoogroups.com Subject: [SPAM] Re: [flexcoders] DataGrid is blank It is unusual to be creating new DataGrids in a loop On 1/20/10 8:08 PM, "normc_actionscript" <normcousin...@hotmail.com> wrote: My DataGrid contains data, but is now showing it. (See itemClickEvent function.) Anybody know why? (PS feel free to critisize any other aspect of my code, i'm just learning) public function itemClickEvent(e:ListEvent):void{ Alert.show(String(e.target.selectedItem)); // THIS SHOWS WHAT'S EXPECTED } public function addToGrid(e:Event):void{ // This adds several 1 column dataGrids to an hbox, because I need lists with column headers. // One dataGrid won't work, because the lists are different lengths. categories = new XMLList(urlLoader.data) for each (var cat:XML in categories.*){ var partsGrid:DataGrid = new DataGrid(); var partsListCollection:XMLListCollection = new XMLListCollection(cat.children()) var df:XML=XML(partsListCollection.getItemAt(0)) partsGrid.dataProvider = partsListCollection; var dgc:DataGridColumn = new DataGridColumn(); dgc.headertext=c...@name.tostring(); dgc.dataField=df.name(); var cols:Array =new Array() cols.push(dgc) partsGrid.columns = cols; gridHbox.addChild(partsGrid) partsGrid.addEventListener(ListEvent.ITEM_CLICK, itemClickEvent) partsGrid.validateNow()// just to show you that I tried this but it doesn't work. } } -- Alex Harui Flex SDK Team Adobe System, Inc. http://blogs. <http://blogs.adobe.com/aharui> adobe.com/aharui