Hi All,
I have a DataGrid whose columns are generated at run time.
In my MXML File it has only one Column and depending on the User
Preference the Columns will be added to the Grid.
Every thing is working fine except the sort won't work on columns as
there is no variable with the column name in the Value Object. I have
a Map in my Value object which contains the list of columns to be
displayed..
Here is my code..
[CODE]
for(var j:int=0;j<propertyCollection.length;j++){
propertyNameTmp = propertyCollection[j];
trace("Adding the Column ="+propertyNameTmp+" To the Grid");
var dgc:DataGridColumn = new DataGridColumn(propertyNameTmp);
trace("Column DataField ="+dgc.dataField);
dgc.headerText= propertyNameTmp;
dgc.labelFunction =getDataFieldValue;
gridCols.push(dgc);
}
else{
trace("No Need to add Column ="+propertyHolder.propertyName+"
as it
already Exists in the Grid");
}
}
private function getDataFieldValue (node : Object, column :
DataGridColumn) : String {
return node.propertyHolderMap[column.dataField];
}
[/CODE]
Is there a function i can call to determine the field in the Value
Object to use for figuring out how to sort the Columns ??
Thanks
Mars