1

I have DataGrid with Dynamic Columns. The columns will contain ItemRendrer. I'm not familiar with dynamically adding ItemRenderer.
My code is:

var column:DataGridColumn = new DataGridColumn();
column.headerText = item;
column.width=150;
column.dataField=item;
column.itemRenderer = WorkNatureRenderer ;
cols.push(column);

WorkNatureRenderer is a mxml component.(Hbox containing TextInput and Button)

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009" 
         xmlns:s="library://ns.adobe.com/flex/spark" 
         xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">

    <s:TextInput/>
    <s:Button/>

</mx:HBox>

But when I add this I got an Error 1067: Implicit coercion of a value of type Class to an unrelated type mx.core:IFactory.

Any examples Or Links..

Santhosh Nayak
  • 2,312
  • 3
  • 35
  • 65

1 Answers1

1

Try this

myList.itemRenderer = new ClassFactory(WorkNatureRenderer);

i guess this will help u...IM NOT SURE..

Aravinth
  • 363
  • 2
  • 10
  • 33
  • 1
    Thank you for quick reply..It seems working.. small mistake I was trying using `WorkNatureRenderer as ClassFactory` which was not working.. – Santhosh Nayak Dec 15 '11 at 10:19
  • @M.S.Nayak hey tats wokay Man...wen it works let me know..This was a unique requirement.. Im curious to work for the same.. cya!:-) – Aravinth Dec 15 '11 at 10:28