我有一个Flex Spark dropdownList,我需要在其中显示Provider FirstName,LastName:
<s:DropDownList id="providerList"
dataProvider="{model.practiceProviderList.practiceProviders}"
labelField="provider.providerName.firstName"/>
但是输出只显示[object Object]&amp; [object Object],因为DB中有2个提供程序,并且不显示实际值。
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;
}
PracticeProvider对象:
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;
}
提供者具有providerName:PersonName作为其中一个字段&amp; PersonName有firstName:String&amp;名字:字符串
我需要在下拉列表中显示名字,姓氏。如果有人可以在这方面提供帮助,我将不胜感激。
由于
哈里什
答案 0 :(得分:3)
labelField无法连接2个值。请改用labelFunction。
如果我了解您的数据模型,请执行以下操作:
public function myLabelFunction(item:Object):String{
return item['providerName']['PersonName']['firstName'] + ' ' + item['providerName']['PersonName']['lastName']
}