# Dynamic datagrid in accordian

**URL:** <https://forum.kirupa.com/t/dynamic-datagrid-in-accordian/228750>\
**Category:** flash\
**Created:** [June 11, 2007, 10:01am UTC](https://forum.kirupa.com/t/dynamic-datagrid-in-accordian/228750 "2007-06-11T10:01:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbuda](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jbuda/32/3723_2.png) [@jbuda](https://forum.kirupa.com/u/jbuda)\
**Post date:** [June 11, 2007, 10:01am UTC](https://forum.kirupa.com/t/dynamic-datagrid-in-accordian/228750/1 "2007-06-11T10:01:55Z")

</div>

Hi all

I have a problem with creating and then populating a datagrid from an XML file.

The .as code below creates a dynamic accordian menu then populates it with either textArea or datagrid. However, the first dataGrid is created and populated with no problems. When the next one gets created it seems to be trying to populate it with the data from the first XML node. Which i dont want to happen

[SIZE=1][FONT=Arial]  
private function createDocumentation():void {  
for (var i:int = 0; i \< generatorProperties.documentation.length; i++) {  
var c:Canvas = new Canvas();  
var vbox:VBox = new VBox();

c.percentWidth = 100;  
c.percentHeight = 100;  
c.label = generatorProperties.documentation\*.heading;

vbox.percentWidth = 96;

for (var j:int = 0; j \< generatorProperties.documentation\*.sections.length; j++) {

```
if (generatorProperties.documentation*.sections[j].image.substr(0,6) != 'TABLE_') {
var t:TextArea = new TextArea();
t.percentWidth = 100;
t.id = 'test_' + i + '_' + j;
t.enabled = false;					
t.text = generatorProperties.documentation*.sections[j].information;
				
vbox.addChild(t);

```

} else {  
var tableInformation:XML = new XML(generatorProperties.documentation\*.sections[j].information);   
var dg ![](http://forum.kirupa.com/uploads/kirupa/1495/f1fea26928e562b8.gif)ataGrid = new DataGrid();   
dg.percentWidth = 100;  
dg.dataProvider = tableInformation.row;  
vbox.addChild(dg);   
}   
}

c.addChild(vbox);  
generatorProperties.documentationAccordian.addChil d©;  
}  
}[/FONT][/SIZE]

Below is an extract of the that i would like to populate the accordian with

[SIZE=1][FONT=Arial]\<section\_4 title=“Customizing iGallery With Actionscript”\>  
\<para\_1 image=""\>As well as using the attributes in the xml and setting parameters in the component inspector. Further control can be added to the iGallery with Actionscript by calling methods, setting properties and creating responders for events.\</para\_1\>  
\<para\_2 image=""\>The following is a list of methods, events and properties :\</para\_2\>  
\<para\_3 image=“TABLE\_METHOD”\>  
\<row a=“iGallery.loadXML(‘_xmlfile_’)” d=“Loads _xmlfile_ into gallery” /\>  
\</para\_3\>  
\<para\_4 image=“TABLE\_EVENT”\>  
\<row a=“onLoadFinished” d=“Triggered when xml file loads and before styles applied. \<br /\> evtObj.pics is an array of objects, each contains pic and caption” /\>  
\<row a=“onStylesFinished” d=“Triggered when xml file defines styles. \<br /\> evtObj.styles is an object containg all styles” /\>  
\<row a=“onThumbLoaded” d=“Triggered when thumbnail finishes loading. \<br /\> evtObj.thumb is reference to thumbnail” /\>  
\<row a=“onThumbOver” d=“Triggered when thumbnail is rolled over. \<br /\> evtObj.thumb is reference to thumbnail” /\>  
\<row a=“onThumbOut” d=“Triggered when thumbnail is rolled out. \<br /\> evtObj.thumb is reference to thumbnail” /\>  
\<row a=“onThumbPress” d=“Triggered when thumbnail is clicked. \<br /\> evtObj.thumb is reference to thumbnail” /\>  
\</para\_4\>  
\<para\_5 image=“TABLE\_PROP”\>  
\<row a=“autoLoadXML” d=“Boolean :: Determines if xml is loaded when component loads. Default - true. \<br /\> Should be set to false when invoking iGallery.loadXML()” /\>  
\<row a=“disableThumbs” d=“Boolean :: Determines if default rollover effects are used. Default - false. \<br /\> Set to true when setting custom rollovers using onThumbOver and onThumbOut” /\>  
\<row a=“defaultXML” d=“String :: Default xml file for gallery to use. Default - iGallery.xml.” /\>  
\</para\_5\>  
\</section\_4\>[/FONT][/SIZE]

Basically, when a ‘para’ node has an image that begins with ‘TABLE\_’ then i wish to have a datagrid created that gets populated with the row nodes.

If anyone can help, or anyone is willing to help, but cannot understand what i have attempted to describe, please let me know and i will try and get a link up for you to check.

Thanks
