如何确定itemRenderer的内部使用外的数据网格范围的变量? [英] How to use out-of-datagrid scope variable inside an ItemRenderer?
问题描述
我使用绑定表项的数组数据网格的ItemRenderer
。我用的是数据
变量来控制绑定数据。我也有 someComponentVariable
是需要被插入到每一行,但其在部件范围内声明,因此在数据网格似乎并不reconize它(编译错误)。
我如何使用这个变量( someComponentVariable
)内的的ItemRenderer
?
$ C $
< MX:DataGrid的ID =userBonusesGridWIDTH =100HEIGHT =248showHeaders =假将wordWrap =真正的>
< MX:列>
< MX:一个DataGridColumn HEADERTEXT =宽度=36>
< MX:itemRenderer的>
< MX:成分>
< MX:垂直框verticalAlign =中间horizontalAlign =中心>
< NS1:SidePanelBonus
bonusName ={data.name}描述={data.description}
箭头={someComponentVariable}>
< / NS1:SidePanelBonus>
< / MX:垂直框>
< / MX:成分>
< / MX:itemRenderer的>
< / MX:一个DataGridColumn>
< / MX:列>
< / MX:数据网格>
如果 someComponentVariable
是类封闭的公共属性的DataGrid
,您可以使用添加outerDocument
从组件
。
< NS1:SidePanelBonus bonusName ={data.name}描述={data.description}
箭头={outerDocument.someComponentVariable}>
< / NS1:SidePanelBonus>
见的创建的内联项目渲染器和编辑器约添加outerDocument
I'm binding an array of items to a data grid using ItemRenderer
. I use the data
variable to control the bindable data. I also have someComponentVariable
that need be inserted into every row but its declared at the component scope, so the data grid doesn't seem to reconize it (compile error).
How can I use this variable (someComponentVariable
) inside the ItemRenderer
?
Code Example
<mx:DataGrid id="userBonusesGrid" width="100" height="248" showHeaders="false" wordWrap="true">
<mx:columns>
<mx:DataGridColumn headerText="" width="36">
<mx:itemRenderer>
<mx:Component>
<mx:VBox verticalAlign="middle" horizontalAlign="center">
<ns1:SidePanelBonus
bonusName="{data.name}" description="{data.description}"
arrow="{someComponentVariable}">
</ns1:SidePanelBonus>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
If someComponentVariable
is a public property of the class enclosing DataGrid
, you can use outerDocument
to access it from a component
.
<ns1:SidePanelBonus bonusName="{data.name}" description="{data.description}"
arrow="{outerDocument.someComponentVariable}">
</ns1:SidePanelBonus>
See the "using the Component tag" section in Creating inline item renderers and editors for more info about outerDocument
这篇关于如何确定itemRenderer的内部使用外的数据网格范围的变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!