Couldn't you create a sealed Category class with id and category
properties? When you get your database return, you could parse the
results into typed Category objects, and add them to an ArrayCollection.
Set the dataProvider to this arraycollection, the labelField to
category, and then later when checking the selectedItem you could do
something like
 
Category(cBox.selectedItem).id
 
to get the id you are looking for.
 
HTH,
Ryan

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of dnk
Sent: Tuesday, September 16, 2008 4:02 PM
To: Flexcoder List
Subject: [flexcoders] Simple question - custom labels and data fields in
ComboBox




Hi there.. I have been googling on this one... I have a ComboBox that
has an ArrayCollection for a dataSource.

Now my ArrayCollection is from a MySQL query.... Now since the ComboBox
control expects the data to have a label field and a data field - it is
obviously seeing my result as [Object], [Object].

Now I know I can change the label field using:

labelField="@category"

Now how can I do the same for the data field?

My database is passing back one called "category" (using that for the
label), and one called "id" (using that one for the data).

Do I have to somehow write a function to convert the "id" to "data"?

DNK 

 


This message is private and confidential. If you have received it in error, 
please notify the sender and remove it from your system.

Reply via email to