【问题标题】:How could I set data provider of one item renderer of a datagrid column based on another item renderer (of same datagrid but different column)?如何基于另一个项目渲染器(相同的数据网格但不同的列)设置数据网格列的一个项目渲染器的数据提供程序?
【发布时间】:2011-02-01 21:24:12
【问题描述】:

我在数据网格的 2 个不同列上有两个项目渲染器。两者都是组合框。我在这里尝试做的是根据在 firxt 组合框中的项目选择设置第二个组合框的数据提供者。但是如何让第二个 itemrenderer 知道第一个中选择的项目是什么?

这里是代码

<mx:DataGridColumn id="deptCol" headerText="Department" width="300">
<mx:itemRenderer>
 <mx:Component>
  <mx:HBox width="100%" height="100%" horizontalAlign="center">
   <mx:ComboBox id="cmbBox1" dataProvider="{XML(data).d.@department_description}" />
  </mx:HBox>
 </mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

<mx:DataGridColumn id="deptCol" headerText="Department" width="300">
<mx:itemRenderer>
 <mx:Component>
  <mx:HBox width="100%" height="100%" horizontalAlign="center">
   <mx:ComboBox id="cmbBox2" dataProvider="{<some DataProvider Based on Selection of cmbBox1> ?? **HOW TO SET IT**}" />
  </mx:HBox>
 </mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

【问题讨论】:

    标签: flash actionscript-3 flex3 adobe


    【解决方案1】:

    好吧,我使用间接技术让它工作...使用 XML 列表作为数据提供者,并在每个级别添加另一个名为“IsSelected”的属性,并在选择后默认为 0(以及每个级别的唯一 ID)第一个组合框我设置了相应的“IsSelected”= 1 ...因此,一个项目渲染器所做的更改可供另一个项目使用。不需要告诉一个使用唯一 ID 识别另一个。

    【讨论】:

      猜你喜欢
      • 2015-07-09
      • 1970-01-01
      • 2011-09-05
      • 1970-01-01
      • 2014-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多