gpt4 book ai didi

apache-flex - 如何在 ItemRenderer 中使用超出数据网格范围的变量?

转载 作者:行者123 更新时间:2023-12-01 13:07:58 26 4
gpt4 key购买 nike

我正在使用 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)属性,您可以使用 outerDocumentcomponent< 访问它.

<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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com