PDA

View Full Version : mx:DataGrid and Actionscript 3


cesperanc@
07-19-2006, 04:40 PM
Hi...
Is it possible add columns to a datagrid using actionscript?
I'm using a datagrid to display fields of a mysql table. Everything works fine, but now I want to control the columns that are displayed because the mysql table is dynamic. For this I want to use actionscript...

I have tryed methods like datagridName.addChild(...) and datagridName.columns.push(...), but it doesn't work. Can someone help me?

Tink
07-20-2006, 10:26 AM
i think

var myColumn:DataGridColumn = new DataGridColumn();
myDataGrid.columns.push( myColumn );

should work?

cesperanc@
07-20-2006, 04:17 PM
I have tryed that, but it doesn't work.

If I try this intructions:


Alert.show(String(myDataGrid.columns.lenght)); //result = 8
var myColumn:DataGridColumn = new DataGridColumn();
Alert.show(String(myDataGrid.columns.push(myColumn ))); //result = 9
Alert.show(String(myDataGrid.columns.lenght)); //result = 8


I can't understand why.

mantra
07-23-2006, 06:06 AM
forgive me if this seems like a stupid comment, i notice you have "lenght" instead of what i'm guessing should be length in your code ?

Alert.show(String(myDataGrid.columns.lenght));