Sample Code:
var len:int = xml_itemCount.children()[0].children().length();
var ttle:String = '';
grid_Reports.columns = [];
for (var i:int=0; i<len; i++)
{
var itm:Object = xml_itemCount.children()[0].children()[i];
ttle = [EMAIL PROTECTED];
if (ttle.length == 0)
ttle = itm.name();
trace(itm.name() + "=" + itm.text());
var tmp:DataGridColumn = new DataGridColumn(itm.name());
tmp.dataField = itm.name();
tmp.headerText = ttle + " - " + i;
grid_Reports.columns[i] = tmp;
trace(grid_Reports.columns.length);
}
_____________________________________________
From: Pottavathini, Sathish
Sent: Wednesday, July 19, 2006 11:48 AM
To: flexcoders@yahoogroups.com
Subject: Adding columns dynamically in a datagrid
I have a datagrid and the data loaded into it is dynamic. The number of columns are also different each time. So I am trying to read the xml data that is used for the datagrid and create columns at run time using 'columns' property of the datagrid. But for some reason it's not creating those columns in datagrid. Am I missing anything?
Any sample code for this kinda thing?
Thanks
Sathish
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Web site design development | Computer software development | Software design and development |
Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.