Dynamic ItemRenderer for Flex Datagrid

亡梦爱人 提交于 2020-01-05 04:02:38

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!