Here you go. make your own modifications in code as per teh need.
<?xml version="1.0"?>
<!-- containers\intro\ContainerComponentsExample2.mxml -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.controls.DataGrid;
/* Import HBox class. */
import mx.containers.HBox;
/* Array of created containers. */
private var hBoxes:Array = [];
private var hBoxes1:Array = [];
//public var dgColumn:Array = new Array(4);
public function addDg():void {
/* Create new HBox container. */
var newDg:DataGrid= new DataGrid();
newDg.name="Label: " + String(hBoxes.length);
newDg.id = "dg";
var dgc1:DataGridColumn = new DataGridColumn();
var dgc2:DataGridColumn = new DataGridColumn();
var dgc3:DataGridColumn = new DataGridColumn();
dgc1.headerText = "col1";
dgc2.headerText = "col2";
dgc3.headerText = "col3";
hBoxes1[0] = dgc1;
hBoxes1[1] = dgc2;
hBoxes1[2] = dgc3;
newDg.columns = hBoxes1;
/* Add it to the Accordion container, and to the
Array of HBox containers. */
hBoxes.push(myAcc.addChild(newDg));
}
public function delDg():void {
/* If there is at least one HBox container in the
Array,
remove it. */
if (hBoxes.length>= 1) {
myAcc.removeChild(hBoxes.pop());
}
}
]]>
</mx:Script>
<mx:Button label="Add Data Grid" click="addDg();"/>
<mx:Button label="Remove Data Grid" click="delDg();"/>
<mx:Panel id="myAcc">
</mx:Panel>
</mx:Application>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---