DataGrid supports addColumn and addColumnAt which are documented in the ASDoc (http://www.macromedia.com/support/documentation/en/flex/1/asdocs/index.html).  If you want to create a new DataGridColumn to add instead of passing strings you simply do:

 

var dgc = new DataGridColumn();

dgc.columnName = //name of the fieldto use for data

dgc.headerText = //text to display in the column header

 

ActionScript allows you to add properties to objects dynamically simply by assigning them.  A Model is just an object so you can simply say myModel.newcolumn = something.  If you're trying to add a new property to every element in an array you're going to have to use a for loop to go through each element and add the property individually.

 

Matt

 

-----Original Message-----
From: Eric Guesdon [mailto:[EMAIL PROTECTED]
Sent: Monday, May 03, 2004 2:15 PM
To: [EMAIL PROTECTED]
Subject: [flexcoders] Dnamic DataGridColumn

 

Hi,

 

Could you help me to add, at runtime, a column to a dataGrid

In thesame time how to add, at run time, tag to a mx:Model

 

Sorry for my English

 

Eric



Reply via email to