----- Original Message ----- From: "Paul Steven" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Tuesday, July 24, 2007 3:37 PM
Subject: [Flashcoders] How to remove a datagrid


Probably a really dumb question but how do I remove a datagrid?

I create the datagrid as follows and I want the function 'Click_Datagrid' to
delete / remove the datagrid.

var myDataGrid:DataGrid = new DataGrid();
myDataGrid.addColumn("Type");
myDataGrid.addColumn("Qualification");
myDataGrid.addColumn("Code");
myDataGrid.addColumn("Students");
myDataGrid.addColumn("Marked");
myDataGrid.addColumn("Submitted");
myDataGrid.addColumn("Series");
myDataGrid.addColumn("DaysLeft");


myDataGrid.columns[0].width = 60;
myDataGrid.columns[1].width = 140;
myDataGrid.columns[2].width = 140;
myDataGrid.columns[3].width = 70;
myDataGrid.columns[4].width = 70;
myDataGrid.columns[5].width = 90;
myDataGrid.columns[6].width = 70;

myDataGrid.addItem({Type:"GCE", Qualification: "Extended Project",
Code:"EPQ-W-SP-06-08", Students:"8",
Marked:"0",Submitted:"0",Series:"November", DaysLeft:"15"});
myDataGrid.width = 720;
myDataGrid.move(20, 160);
myDataGrid.columns[7].headerText = "Days Left";
myDataGrid.rowCount = myDataGrid.length;
addChild(myDataGrid);

myDataGrid.addEventListener(ListEvent.ITEM_CLICK, Click_Datagrid);

function Click_Datagrid(evt_obj:Object) {

var vDG = evt_obj.target;

   // Code to remove / delete the datagrid here

Probably something like this..

       evt_obj.currentTarget.parent.removeChild(evt_obj.currentTarget);

Paul

gotoAndStop("qualificationSummary");

}

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to