Hi Oleg,

Use the columnNames property before setting your dataprovider:

// only show column1 and column2
datagrid.columnNames = ["column1", "column2"]
datagrid.dataProvider = myDP; 
datagrid.columns[0].headerText = "Olegs Column"

Datagrid columnName:
http://livedocs.macromedia.com/flash/8/main/00003271.html

Datagrid strategies:
http://livedocs.macromedia.com/flash/8/main/00003253.html

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Oleg
Filipchuk
Sent: Wednesday, February 22, 2006 8:32 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] DataGrid Columns question

Thanks all,
I've found solution by setting up columns ahead of time:

private function createColumn( prop:String, label:String ):DataGridColumn {
    var clmn:DataGridColumn = new DataGridColumn(prop);
    clmn.headerText = label;
   return clmn;
}

dataGrid.addColumn(createColumn("nickname", "NickName"));
dataGrid.addColumn(createColumn("fullname", "Full name"));
dataGrid.addColumn(createColumn("tel", "Telephone"));
dataGrid.addColumn(createColumn("address", "Address"));

and after that I can asign data provider safely.

But there is the nasty quirk - if I call dataGrid.spaceColumnsEqually()  -
dataGrid shows no column at all, so I have to set up width of every column
individually.

Thanks all for help,
Oleg
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to