问题
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..
回答1:
Try this
myList.itemRenderer = new ClassFactory(WorkNatureRenderer);
i guess this will help u...IM NOT SURE..
来源:https://stackoverflow.com/questions/8518206/dynamic-itemrenderer-for-flex-datagrid