views:

18

answers:

2

Hi,

I am trying to display country codes(+91, +60, +01) in the combobox. Although the dataprovider(array) contains + sign but is removed. I am not getting how to show it with sign.

<mx:Array id="countryArray">

<mx:Object label="India" data="+91" />

<mx:Object label="Malaysia" data="+60" />

<mx:Object label="Usa" data="+01" />

</mx:Array> 

Is this the problem with dataprovider? How can I treate them as text not numbers?

Please help.

Thanks in advance.

A: 

I like this question as its not a topic obviously apparent in the Docs. The 'data' in your object can be anything, so convert it to a string may work...

<mx:Array id="countryArray">

<mx:Object label="India" data="'+91'" />

<mx:Object label="Malaysia" data="'+60'" />

<mx:Object label="Usa" data="'+01'" />

</mx:Array> 

You can see I've nested single speech marks in doubles. Does it work?

Glycerine
gauravgr8
A: 

is this possible? well - not possible, Allowed:

<mx:Object label="India" data="{String('+91')}" />
Glycerine
Thanks Glycerine,It worked for me.
gauravgr8