简体   繁体   中英

Flex Mobile Access List value from itemRenderer

I have a list which is populated by list.dataProvider:

<fx:Script>
    <![CDATA[
        list.dataProvider = new ArrayCollection(getClass.listArticles(group, subgroup));
    ]]>
</fx:Script>

<s:List id="list" x="0" y="0" width="100%" height="100%" labelField="ArticleName" change="navigator.pushView(DetailView, list.selectedItem)">
    <s:itemRenderer>
        <fx:Component>
            <s:IconItemRenderer labelField="ArticleName"
                                messageField="EAN"/>
        <s:Image source="@Embed('assets/images/{EAN}.jpg')" width="70" height="70" horizontalCenter="0" verticalCenter="0" />
        </fx:Component>
    </s:itemRenderer>
    <s:layout>
        <s:TileLayout columnWidth="200" rowHeight="200" columnAlign="justifyUsingWidth" horizontalGap="10" orientation="rows" verticalGap="10"/>
    </s:layout>
</s:List>

labelField and messageField values are properly filled with the result of the dataProvider. The image source variable is not. How do I get/access this variable from the dataProvider ({EAN})?

Maybe by overriding set/get data?

        override public function set data(value:Object):void {
            super.data = value;

            if (!data)
                  return;

            img.source = data['EAN'];
            // or maybe: var xml:XML = data as XML; etc.
        }

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