|
Thanks Matt, // ============= <mx:Script> ����������������������� import
mx.controls.gridclasses.DataGridColumn; ����������������������� function
changeProvider(){ ����������������������� ���������������������������������� var
phone = new DataGridColumn("phone"); ���������������������������������������������� phone.headerText
= "Phone" ���������������������������������������������� phone.columnName
= "phone" ���������������������������������������������� phone.width
= 100 ���������������������������������������������� dg.removeColumnAt(1) ���������������������������������������������� dg.addColumnAt(1,phone) ���������������������������������������������� ���������������������������������� var
email = new DataGridColumn("email"); ���������������������������������������������� email.headerText
= "E-mail" ���������������������������������������������� email.columnName
= "email" ���������������������������������������������� email.width
= 100 ���������������������������������������������� dg.removeColumnAt(2) ���������������������������������������������� dg.addColumnAt(2,email) ����������������������� ���������������������������������� var
o:Object = new Object() ���������������������������������������������� o.name
= "Corinne Cuciz" ���������������������������������������������� o.phone
= "06 69 53 70 94" ���������������������������������������������� o.email = "[EMAIL PROTECTED]" ���������������������������������� ���������������������������������� dg.addItem(o) ���������������������������������� dg.spaceColumnsEqually(); ����������������������� } ��� </mx:Script> // ================= But cos my datagriduse a
mx:Model at compile time, i first try to chnage dynamically the model …. In fact I prefere
actionScript Eric De : Matt Chotin
[mailto:[EMAIL PROTECTED] 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 field to use for data dgc.headerText = //text
to display in the column header ActionScript allowsyou
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 inan
array you're going to have to use a for loop to go through each element andadd
the property individually. Matt -----Original
Message----- Hi, Could you help me to add, at runtime, a column to a dataGrid In the same time how to add, at run time, tag to a mx:Model Sorry for my English Eric
|
- RE: [flexcoders] Dnamic DataGridColumn Matt Chotin
- Eric Guesdon

