Get DataGrid Column Headings and data values

Posted on 2009-02-10
Medium Priority
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

papalpha earned 0 total points
ID: 23606017
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are like me and like multiple layers of protection, read on!
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
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…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

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