You can addItem() when you do not know the name of the column?

I am trying to enter data into a DataGrid via XML. I do not know in advance what will be the names of the columns. I understand that it is supposed to function as:

var sampleItem:Object = {ColName:10};

dataGridMain.addItem (sampleItem);

but it's no help if you don't know what will be the name of the column (column).

Can I replace the value (10) with variables that match my xml values (output.row [0] .col [0]) and it works fine. But if I try to do the same for column name, it doesn't quite work. How can I use a dynamic of the names of columns in the dataGrid?

gr8 to know that you have found the solution...

Alternatively, you can make the dynamic columns same name as the name of the xml tag using dataprovider. Here's a simple example.

****************************************************************************************

var dp:Array = new Array();

var xml =
   
        TestTrack 1
        Band1
        test1.MP3
   
   
        TestTrack 2
        Wewayakai2
        test2.MP3
   
   
        TestTrack 3
        Band3
        test3.MP3
   
   
        TestTrack 4
        BAND4
        test4.MP3
   
;

for (var i: int = 0; i
var xmlc:XMLList = xml.track [i] .children ();
var col1:String = (xmlc [0] as XML) .localName () as String
var col2:String = xmlc [1] .localName () as String
var col3:String = xmlc [2] .localName () as String
var obj:Object = new Object();
obj [col1] = xml.track [i] .title;
obj [col2] = xml.track [i] .band;
obj [col3] = xml.track [i] mpfprojectdir\dev10\src\csharp\projectbase.file;
DP.push (obj);
}

dg.dataProvider = new DataProvider (dp);

*****************************************************************************************

Kind regards

Karthikeyan R

Tags: Adobe Animate

Similar Questions

Maybe you are looking for

  • New subfolder does not display the unread messages in the left pane.

    I created a filter for messages on the mail server. It places the messages to a specific e-mail address in a folder on the IMAP server. Yet, when Thunderbird is opened, it does not show in the pane on the left in bold all new messages in this folder,

  • Gadgets don't be loading not on the homepage igoogle with FF 7 or 8 but works on Chrome and IE

    I have Win XP and running 7 FF. Yesterday, my igoogle homepage leave loading all the gadgets, but it works fine on Chrome and IE. I checked the forums and tried all suggestions regarding extensions and add it. Today, I downloaded 8 FF, but it does no

  • TTL bypass capacitor

    Hi, thanks for your response. I am a logic circuit TTL with Multisim and Ultiboard design. For noise problems, I need to place bypass capacitors each Vcc and GND pins for each lately but since those pins are hidden in Multisim, I do not know how?

  • How to calculate the overall RMS of a linear spectrum?

    It is a calculation of post data capture, so it should be no big deal, but I can't do things.  I have a linear spectrum of the 16 250 line.  I want the overall RMS so that the frequencies.  This means take each value of y for each point and square it

  • How to remove avg

    I tried to remove avg after getting through windstream.com anti-virus, it said that I had to remove avg; It will not now leave, I have no protection! gives error to reinstall or remove.