Skip to main content
Participant
January 4, 2008
Question

Need help with Object

  • January 4, 2008
  • 1 reply
  • 176 views
Hello,

Hopefully someone can help me out.

I created and populated an object like the following:
var myObj:Object = new Object();
myObj = {column01:column01Val,column02:column02Val};

then I threw this into a dataGrid like this:
var myDataGrid:DataGrid = new DataGrid();
myDataGrid.dataProvider = myObj;

the problem is that when the component is drawn, the order of the columns change like the following:

column02 | column01
-----------------------------------------
column02Val | column01Val

instead of:

column01 | column02
-----------------------------------------
column01Val | column02Val

Does anyone know why this is?

Thanks in advance!
Vazy
This topic has been closed for replies.

1 reply

Participating Frequently
January 4, 2008
Try using the following syntax:

var sampleItem1:Object = { Name:"John Alpha", Number:"555-123-0101", Email:"jalpha@fictitious.com" };
var sampleItem2:Object = { Name:"Mary Bravo", Number:"555-372-3322", Email:"mbravo@fictitious.com" };

dg.rowCount = 2;
dg.columns = ["Name", "Number", "Email"];
dg.addItem(sampleItem1);
dg.addItem(sampleItem2);