Thanks very much. That worked.

Anatole Tartakovsky wrote:
That is "columns" property of DataGrid - you do need to to loop through your XML to create DataGridColumn instances - here is internal demo of framework object that does it via data driven UI:
HTH,
Anatole Tartakovsky
 
 
----- Original Message -----
Sent: Tuesday, February 14, 2006 5:23 PM
Subject: [flexcoders] Dynamic DataGridColumns

Flexcoders,

Is there any way to assign the DataGridColumns dynamically?

Instead of hardcoding each of the DataGridColumn, I would like to dynamically create an Array of them using the 'mydata' ArrayCollection.

---------------------------------------------------------------------------------
var mydata:ArrayCollection = new ArrayCollection(myservice.result.data.row);

<mx:DataGrid id="zndg" width="100%" height="100%"  dataProvider="{mydata}">
                <mx:columns>
                    <mx:Array>
                        <mx:DataGridColumn columnName="EMPNO" />
                        <mx:DataGridColumn columnName="ENAME" />
                   </mx:Array>
              </mx:columns>
 </mx:DataGrid>
---------------------------------------------------------------------------------

In the example below the "myservice.result.data.row"  is an XML structure::

<row>
    <EMPNO>346546</EMPNO>
    <ENAME>John Roberts</ENAME>
</row>
<row>
    <EMPNO>346546</EMPNO>
    <ENAME>John Roberts</ENAME>
</row>





--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to