addOptions - format the text/value shown in listbox (select)
I have a java-method returning a collection with javabeans with countries
which have an id and a name
something like ('SE', 'Sweden), ('DK', 'Denmark')
I use addOptions like this:
dwr.util.addOptions('mylistbox', data, 'id', 'name');
data is the result from dwr with id and name for many countries.
Is there a way to format the text that is shown in the listbox?
Now in the listbox the name of the countries is shown:
like "Sweden, Denmark", etc
The value in the listbox is the "id" of the country: SE, DK, etc
I would like to format the text (shown to the user in the listbox), so
more than the country name is shown.
For example, I would like the result to be
'SE Sweden', 'DK Denmark' in the listbox.
Is there a way with addOptions to do this?
/Andreas