Hi all, I have an XML file & a datagrid instance on my stage. Following is the code I am using to populate data into the grid: var myXMLv:XML = new XML(); myXMLv.ignoreWhite=true; mydg.addColumn('Employee'); //mydg is the datagrid instance name mydg.addColumn('Extension'); myXMLv.onLoad = function(success:Boolean){ var xmlctr:Number; var gridctr:Number; for(xmlctr = 0,gridctr=1;xmlctr<myXMLv.firstChild.childNodes.length,gridctr<(myXMLv.firstChil d.childNodes.length-1);xmlctr++,gridctr++) { var myData = {Employee:myXMLv.firstChild.childNodes[0].attributes.name,Extension:242}; mydg.addItemAt(gridctr, myData); } } myXMLv.load('data.xml'); Upon playing the movie I get this error - 'Cannot add an item past the end of the DataProvider'. Can anyone plz help me with this? Thanks, Robi
Hi Rob, First of all, you might want to clean up the code in your posting so it's easier to read. Second, I don't see you setting the data provider in your code. That could be the problem although it usually just fails quietly if you don't set it.. I have just finished working on populating a datagrid component with an xml file and I might be able to help you out if you can provide more info on your code. Mark
Don't see what you're looking for? Try a search.
|