flex 3 和 itemRenderer [英] flex 3 and itemRenderers

查看:29
本文介绍了flex 3 和 itemRenderer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据网格,其中一列使用项目渲染器来显示内容.我想知道是否可以在 itemRenderer 的脚本块内访问 datagrid 的 dataprovider 内容.

i have a datagrid and for one of the columns im using an item renderer to display content. Im wondering is it possible to access the dataprovider content of the datagrid inside a script block in the itemRenderer.

目前我可以使用 data.variableName 访问项目渲染器中组件中的 dataprovider.

Currently I can access the dataprovider in a component in the item renderer using data.variableName.

我希望能够对脚本块中的这个变量进行一些错误处理,有什么想法吗?

I want to be able do some error handling on this variable in the script block, any ideas?

推荐答案

您可以指定自己的 ItemRenderer 组件.在该组件的 MXML 中,您可以使用 Script 块.

You can specify your own ItemRenderer component. Within the MXML of that component you can use the Script block however like.

只需将该组件指定为 ItemRenderer,如下所示:

Just specify the that component as the ItemRenderer like so:

<mx:DataGrid dataProvider="{ac}">
mx:columns>
    <mx:DataGridColumn>
        <mx:itemRenderer>
            <mx:Component>
                <local:YourRenderer />  
            </mx:Component>
        </mx:itemRenderer>
    </mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>

这篇关于flex 3 和 itemRenderer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆