代码之家  ›  专栏  ›  技术社区  ›  FlyingCat

如何访问ArrayCollection数据

  •  0
  • FlyingCat  · 技术社区  · 14 年前

    我知道这个可能很简单,但我想不通。

    <s:List id="compList"
    width="250"
    height="350"
    creationComplete="compList_creationCompleteHandler(event)"
    itemRenderer="itemRenderer.compListItemRenderer"
    change="compList_changeHandler(event)"  //when a user select a row, the datagrid will display the data.
    >
    <s:AsyncListView list="{compinfoResult.lastResult}"/>
    
    </s:List>
    
    
    
    
    <mx:DataGrid id="dataGrid" dataProvider="{compDetailinfoResult.lastResult}">      //The dataGrid display the data fine
    <mx:columns>
    <mx:DataGridColumn dataField="user" headerText="User"/>
    <mx:DataGridColumn dataField="brand" headerText="Brand"/>
    <mx:DataGridColumn dataField="compModel" headerText="Model"/>
    <mx:DataGridColumn dataField="picture" headerText="Product Picture"/>
    </mx:columns>
    </mx:DataGrid>
    
    
    <mx:Image source="??????" />   // I want to display productPicture here too but not sure what to add here.....
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   JeffryHouser    14 年前

    尝试以下操作:

    <mx:Image source="{dataGrid.selectedItem.sourcelocation}" />
    

    如果您有一个正在运行的示例和/或对组成列表的值对象的解释,则更容易变得更具体。我觉得你的做法很奇怪;看起来您正在使用DataGrid来显示单个项。对吗?数据网格适合以类似表格的格式显示多个相似的项目;我不确定我是否会用它来做一件东西。