Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to skin dropdownlist with different arraycollection field
    text
    copied!<p>I use dropdownlist in different location on my air application. For those dataprovider, is always an arraycollection, but some with one field, like </p> <p>case 1</p> <pre><code>var collection:ArrayCollection = new ArrayCollection(["foo", "foo2", "foo3"]); </code></pre> <p>And some times arraycollection is populate with other method has several field:</p> <p>Case 2</p> <pre><code>var collection:ArrayCollection = new ArrayCollection ( [{DESC:"foo", ID:"0"}, {DESC:"foo1", ID:"1"}, {DESC:"foo2",ID:"2"}, {DESC:"foo3", ID:"3"} ] ); </code></pre> <p>In this case labelField is Desc.</p> <p>So, I like to custom DDL, and I create a skin with itemrender for label part:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" autoDrawBackground="true"&gt; &lt;s:states&gt; &lt;s:State name="normal"/&gt; &lt;s:State name="hovered"/&gt; &lt;s:State name="selected"/&gt; &lt;/s:states&gt; &lt;s:Label text="{data}" backgroundColor.selected="#1B5790" color.selected="white" backgroundColor.hovered="#E1DFD2" color.hovered="white" fontWeight.hovered="bold" width="100%" height="25" paddingLeft="5" paddingTop="5" styleName="myLabelBlack" toolTip="{data}"/&gt; &lt;/s:ItemRenderer&gt; </code></pre> <p>This method works well with example 1 (arListBank) but display [Object object] with case 2.</p> <p>So my goal is to have the same itemrenderer in both case.</p> <p>Could you help me?</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload