开发者

Flex DropDownList ItemRenderer probably a bug

I am trying to make a simple change on look of Flex 4.5 Spark DropDownLis trough extending it's item renderer, anyway even a just shiny new item renderer bring me as result a items which labels is blanks. If i remove the renderer everything is fine, but with it - the items is blank white.

<s:DropDownList id="cbX" x="140" y="281" width="276" itemRenderer="comboItemRenderer" labelField="@text">
    <mx:XMLListCollection>
        <fx:XMLLi开发者_运维知识库st>
            <node text="1" />
            <node text="2" />
            <node text="3" />
        </fx:XMLList>
    </mx:XMLListCollection>
</s:DropDownList>

item renderer :

<?xml version="1.0" encoding="utf-8"?>
<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">

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

</s:ItemRenderer>

Is it a bug, or i am doing it wrong ?


Try to use:

<?xml version="1.0" encoding="utf-8"?>
<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">

    <s:Label text="{label}"/>

</s:ItemRenderer>

The data for the renderer is still the data. But if you use labelField you rely on List's label calculation routine. So just display it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜