ActionScript 2.0 Components Language Reference |
|
|
|
| DataGrid component > DataGrid.removeColumnAt() | |||
Flash Player 6 (6.0.79.0).
Flash MX Professional 2004.
myDataGrid.removeColumnAt(index)
index The index of the column to remove.
A reference to the DataGridColumn object that was removed.
Method; removes the DataGridColumn object at the specified index.
The following example removes the first DataGridColumn object when the button is clicked. With a DataGrid instance named my_dg and a Button instance named name_button on the Stage, paste the following code in the first frame of the main timeline:
my_dg.setSize(140, 100);
my_dg.move(10, 40);
name_button.setSize(140, name_button.height);
name_button.move(10, 10);
// Set up sample data.
var myDP_array:Array = new Array();
myDP_array.push({name:"Clark", score:3135});
myDP_array.push({name:"Bruce", score:403});
myDP_array.push({name:"Peter", score:25});
my_dg.dataProvider = myDP_array;
// Create listener object.
var buttonListener:Object = new Object();
buttonListener.click = function(evt_obj:Object) {
my_dg.removeColumnAt(my_dg.getColumnIndex("name"));
evt_obj.target.enabled = false;
};
// Add button listener.
name_button.addEventListener("click", buttonListener);
|
|
|
|