作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 ItemRenderer
将项目数组绑定(bind)到数据网格。我使用 data
变量来控制可绑定(bind)数据。我还有 someComponentVariable
需要插入到每一行中,但它是在组件范围内声明的,所以数据网格似乎没有重新调整它(编译错误)。
如何在 ItemRenderer
中使用这个变量 (someComponentVariable
)?
<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>
最佳答案
如果 someComponentVariable
是包含 DataGrid
的类的公共(public)属性,您可以使用 outerDocument
从 component< 访问它
.
<ns1:SidePanelBonus bonusName="{data.name}" description="{data.description}"
arrow="{outerDocument.someComponentVariable}">
</ns1:SidePanelBonus>
请参阅 Creating inline item renderers and editors 中的“使用组件标记”部分有关 outerDocument
关于apache-flex - 如何在 ItemRenderer 中使用超出数据网格范围的变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1453943/
我是一名优秀的程序员,十分优秀!