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();
[email protected]();
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.
}
}