How do I set a custom value for an option?

I’d like to set a custom value for an option. When looking at the Select API (http://toolkit.itmill.com/demo/doc/api/com/itmill/toolkit/ui/Select.html), this seems not to be possible.

By populating a select with the Select.addItem(Object), each option gets a value starting from 1. I’d like to set a specific value for each option, not a value from the enumeration starting from 1.

Is this possible?

Add values to select with addItem(yourValue). To given them different visible names, use setItemCaption(yourValue, visibleName).

The Manual has more detailed description of the Select component together with some examples. See the section on Select in http://itmill.com/manual/ . There is currently no example about your use case though. The Object parameter for the additem() is really the
identifier
of the item, but by default it is used also as the item caption. You can set the caption with setItemCaption(), but the class offers ways to retrieve them from the string value of the objects or their Properties.