English 中文(简体)
落地列表 [对象对象]
原标题:dropdowlist [object object]

我发现与下降列表。

事实上,我通过向 Mysql 数据库的查询 输入数据。

但在 Mysql 中, 有一张记录是空的字段 。

在此情况下, 灵活显示 [对象对象], 而不是 。

[Bindable] private var DP_CLASSES:ArrayCollection;

<s:DropDownList id="dpClassTT" width="77" 
    dataProvider="{DP_CLASSES}"labelField="Nom"
    />

/ 数据提供样本

 <TypesTT>
   <TypeTT>
     <Nom> </Nom>
   </TypeTT>
   <TypeTT>
     <Nom>AppA</Nom>
   <TypeTT>
<TypesTT>

线条 [Objet 对象] 显示在下拉列表中, 即使名称是空格( 如记录一) 。

你知道怎么解决吗?

谢谢 谢谢

最佳回答

从您在此张贴的有限信息中我只能说, 您需要设置下调列表的 < code> 标签字段

您可以在 mxml 中做到这一点

<s:DropDownList dataProvider="{myQuery}" labelField="colName" />

或者,您设置了一个标签功能,比如:

<s:Script>
    private function toLabel(item:Object):String {
        return item["colName"].toString();
    }
</s:Script>
<s:DropDownList dataProvider="{myQuery}" labelFunction="toLabel" />

在您更新了您的问题后, < 坚固 > EDIT , 我认为最好使用标签功能 。

您的标签功能会是这样的:

function toLabel(item:Object):String {
    var str:String=item["Nom"] as String;
    if(str==null || str==undefined) {
        str="";
    }
    return str;
}

我们需要这样做, 因为空标签 < code> Nom 在 AS3 中被当作 XML 列表对象, 所以必须投下它 。

问题回答

暂无回答




相关问题
Disable button tooltip in AS3

I want to disable the tooltip on certain buttons. The tooltip manager seems to be an all or nothing solution. Is it possible to disable the tooltip for just one or two buttons?

Multiple Remote call made simultenously

I was making multiple remote calls and they are done sequentially and when I am getting a result event back it s triggering calls to all the methods with ResultEvent as an argument . I am supposed to ...

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

Clearing RSL in Cache

I have built a flex application which has a "main" project and it is assosciated with a few RSL s which are loaded and cached once i run my "main" application. The problem i am facing is that the ...

What s a good way of deserializing data into mock objects?

I m writing a mock backend service for my flex application. Because I will likely need to add/edit/modify the mock data over time, I d prefer not to generate the data in code like this: var mockData =...

AS3 try/catch out of memory

I m loading a few huge images on my flex/as3 app, but I can t manage to catch the error when the flash player runs out of memory. Here is the what I was thinking might work (I use ???? because i dont ...

热门标签