Flex DropdownList 不显示正确的值

发布于 2024-09-18 19:36:15 字数 1860 浏览 4 评论 0原文

我有一个 Flex Spark dropdownList,我需要在其中显示提供者名字、姓氏:

   <s:DropDownList id="providerList"
            dataProvider="{model.practiceProviderList.practiceProviders}"
    labelField="provider.providerName.firstName"/>

但输出仅显示 [object Object] & [object Object] 因为数据库中有 2 个提供者,并且不显示实际值。

PracticeProviderList.as:PracticeProvider

[Bindable]
    [RemoteClass(alias="model.PracticeProviderList")]
    public class PracticeProviderList extends PracticeProviderListBase {

        private var _practiceProviderList:ArrayCollection;

        public function get practiceProviders():ArrayCollection
        {
            return _practiceProviderList;
        }

        public function set practiceProviders(value:ArrayCollection):void 
        {
            _practiceProviderList = value;
        }

对象:

public class PracticeProvider  {

        private var _practiceId:Number;
        private var _practiceProviderId:Number;
        private var _provider:Provider;

        public function set practiceId(value:Number):void {
            _practiceId = value;
        }
        public function get practiceId():Number {
            return _practiceId;
        }

        public function set practiceProviderId(value:Number):void {
            _practiceProviderId = value;
        }
        public function get practiceProviderId():Number {
            return _practiceProviderId;
        }

        public function set provider(value:Provider):void {
            _provider = value;
        }
        public function get provider():Provider {
            return _provider;
        }

Provider 将providerName:PersonName 作为其字段之一& PersonName 有firstName:String & lastName:String

我需要在下拉列表中显示名字、姓氏。如果有人可以在这方面提供帮助,我将不胜感激。

谢谢哈里什

I have a Flex Spark dropdownList in which I need to show the Provider FirstName,LastName:

   <s:DropDownList id="providerList"
            dataProvider="{model.practiceProviderList.practiceProviders}"
    labelField="provider.providerName.firstName"/>

But the output shows only [object Object] & [object Object] as there are 2 providers in the DB and does not show the actual values.

The PracticeProviderList.as:

[Bindable]
    [RemoteClass(alias="model.PracticeProviderList")]
    public class PracticeProviderList extends PracticeProviderListBase {

        private var _practiceProviderList:ArrayCollection;

        public function get practiceProviders():ArrayCollection
        {
            return _practiceProviderList;
        }

        public function set practiceProviders(value:ArrayCollection):void 
        {
            _practiceProviderList = value;
        }

The PracticeProvider Object:

public class PracticeProvider  {

        private var _practiceId:Number;
        private var _practiceProviderId:Number;
        private var _provider:Provider;

        public function set practiceId(value:Number):void {
            _practiceId = value;
        }
        public function get practiceId():Number {
            return _practiceId;
        }

        public function set practiceProviderId(value:Number):void {
            _practiceProviderId = value;
        }
        public function get practiceProviderId():Number {
            return _practiceProviderId;
        }

        public function set provider(value:Provider):void {
            _provider = value;
        }
        public function get provider():Provider {
            return _provider;
        }

The Provider has providerName:PersonName as one of it's fields & PersonName has firstName:String & lastName:String

I need to show the First Name, Last Name in the dropdownlist. I would appreciate if someone can help in this regard.

Thanks

Harish

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风追烟花雨 2024-09-25 19:36:15

labelField 无法连接 2 个值。使用 labelFunction 相反。

如果我理解你的数据模型,是这样的:

public function myLabelFunction(item:Object):String{
 return item['providerName']['PersonName']['firstName'] + ' ' + item['providerName']['PersonName']['lastName']
}

The labelField can't concatenate 2 values. Use a labelFunction instead.

If I understand your data model, Something like this:

public function myLabelFunction(item:Object):String{
 return item['providerName']['PersonName']['firstName'] + ' ' + item['providerName']['PersonName']['lastName']
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文