简体   繁体   中英

How to get specific item from Array Collection in Adobe Flex 4.6

In this specific part of code:

<s:DataGroup
  dataProvider="{prodCollection}" 
  itemRenderer="spark.skins.spark.DefaultItemRenderer">

  <s:layout>
    <s:HorizontalLayout />
  </s:layout>
</s:DataGroup>

the ArrayCollection is built from a XML file but prodCollection (bindable) is formed by many childrens. In fact this code returns [obj][obj] and I would like to extract one: product_name .

I tried without result to:

  • use a for loop by function : prodCollection.getItemAt(i).product_name
  • use idHttpservice.LastResult.Lista.product_name in dataprovider="{}"

The part of XML file:

<lista>
  <Prodotto>
    <fam>Soft Drink</fam>
    <product_name>Coca Cola</product_name>
    <image>images/coca_cola.gif</image>
  </Prodotto>
</lista>

Thanks.

Just use a custom item renderer instead of DefaultItemRenderer, and define it in a separate file like this:

<s:ItemRenderer xmlns="...">

    <s:Label text="{ data.product_name }"/>
    ...
</s:ItemRenderer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM