Apache flex 如何更改Flex DataGrid中单个单元格的样式?
我有一个FlexDataGrid,其中一个单元格需要以不同于其他单元格的方式呈现。具体来说,对于网格的一行,其中一个单元格应隐藏 DataGridColumn在my.mxml文件中的设置如下:Apache flex 如何更改Flex DataGrid中单个单元格的样式?,apache-flex,actionscript,datagrid,Apache Flex,Actionscript,Datagrid,我有一个FlexDataGrid,其中一个单元格需要以不同于其他单元格的方式呈现。具体来说,对于网格的一行,其中一个单元格应隐藏 DataGridColumn在my.mxml文件中的设置如下: <mx:DataGridColumn editable="false" dataField="interactive" headerText="Select?" width="45"> <mx:itemRenderer> <mx
<mx:DataGridColumn editable="false" dataField="interactive" headerText="Select?" width="45">
<mx:itemRenderer>
<mx:Component>
<mx:CheckBox selectedField="isInteractive"
click="data.isInteractive=!data.isInteractive; this.parent.parent.dispatchEvent(new Event('interactive_changed'));"
paddingLeft="5"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
我最初的想法是将条件添加到mx:CheckBox,如下所示:
<mx:CheckBox visible="{!data.isBackground}" ...
但这不起作用-事实上,它以一种相当有趣的方式把显示搞得一团糟,一行中的另一个单元格会得到一个额外的复选框。。。算了吧
我怀疑使用自定义ItemRenderer类是可能的,但对于一个相当简单的情况来说,这似乎需要大量的代码开销。有什么想法吗
如果相关的话,我使用的是Flex 3.5。在Flex 3.5中,您需要一个自定义的itemRenderer 我要做的是我有两个州。Normal和复选框,然后在覆盖itemRenderer中的数据设置器时,相应地更改状态
在Flex 4+中,Spark datagrid上有一个ItemRenderFunction属性,您可以通过编程方式选择itemRenderer,这很酷。但这不起作用为什么不呢?你有运行时错误吗?还是编译时错误?或者别的什么?没有运行时错误,没有编译时错误,只是奇怪的行为:一个额外的复选框显示在左边网格单元的顶部。谢谢!在不久的将来我们将项目转移到Flex4之前修复它,这对我来说是不值得的。