Get DataGrid Column Headings and data values

Posted on 2009-02-10
Last Modified: 2012-06-27
I have a datagrid using the following code:
<mx:DataGrid id="dg1" width="100%" dataProvider="{originalTRac}" />
The datagrid display indicates that there is data in the datagrid.
In an ActionScript procedure, I need to be able to get the column heading and the value into two different variables so that I can use them in building an ArrayCollection.  Is there a way of getting the datagrid column names and data values when they are read in and not pre-defined?
Question by:papalpha
    1 Comment

    Accepted Solution

    I have got the heading, now I need to get the data under the heading.  There is only 1 row of data.  I got the heading with the below code, where dg1 is the datagrid id.

    var loopmax:int = dg1.columnCount;
    var dg1ColumnArr:Array = dg1.columns;
    for (i=0; i<loopmax; i++) {
          TRlabel = dg1ColumnArr[i].headerText;

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
    A high-level exploration of how our ever-increasing access to information has changed the way we do our jobs.
    The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
    The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now