I am trying to make a datagrid, that will dynamically add columns to it based on some condition. Now, I am able to add the columns, but I want the newly added column to have button using itemRenderer.
I am unable to achieve this though. Getting this error on line 1
Description Resource Path Location Type 1067: Implicit coercion of a value of type mx.controls:Button to an unrelated type mx.core:IFactory. Demo.mxml /Demo/src line 14 Flex Problem
Can anyone help ?
Here's a code snippet :
private function addDataGridColumn(dataField:String):void {
var dgc:DataGridColumn = new DataGridColumn();
dgc.itemRenderer = button1; // Line 1
var cols:Array = dataGrid.columns;
cols.push(dgc);
dataGrid.columns = cols;
}