Help accesing the DataGrid from inside the Renderer
Hello,
I have created an renderer to modify the content of one of the columns of the DataGrid.
Code:
package {
import fl.containers.UILoader;
import fl.controls.listClasses.ICellRenderer;
import fl.controls.listClasses.ListData;
import fl.core.InvalidationType;
import fl.data.DataProvider;
import flash.events.Event;
import flash.display.*;
import flash.events.*;
import fl.controls.listClasses.*;
public class LoaderCellRenderer extends CellRenderer implements ICellRenderer {
var but:button = new button();
// protected var _data:Object;
// protected var _listData:ListData;
// protected var _selected:Boolean;
public function LoaderCellRenderer():void {
trace("LoaderCellRenderer "+_listData)
super();
this.mouseChildren = true
this.addChild(but )
but.gotoAndStop(1);
textField.text = "";
//this
but.addEventListener(MouseEvent.CLICK, buttonClicked);
}
function buttonClicked(evt:Event):void
{
trace(evt.target.parent.name);
}
override protected function drawLayout():void {
//trace("LoaderCellRenderer "+textField.text)
textField.text = "";
//textField.width = this.width;
//textField.htmlText = textField.text;
super.drawLayout();
}
}
}
but how can i access the parent DataGrid or anything outside of this class ?
In Java it can be done, but how can i pass any value to this class.
My use case is that i click on a delete button and the row is deleted, impossible to do if i cannot access the parent DataGrid and call methods to work with it.
Thanks