Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Combobox shows only distinct values?

Andrej Kocen
6 years ago Aug 28, 2015 7:46am
Jonas Ohlsson
6 years ago Aug 28, 2015 9:07am
Andrej Kocen
6 years ago Aug 28, 2015 10:53am
Jonas Ohlsson
6 years ago Aug 28, 2015 10:59am

ComboBox c = new ComboBox()
c.addItem("Id 1")
c.addItem("Id 2")
c.addItem("Id 3")
c.setItemCaption("Id 1","1")
c.setItemCaption("Id 2","1")
c.setItemCaption("Id 3","2")

This way they will show up as 1, 1 and 2 in your box, but the ids of them are Id 1, Id 2 and Id 3 respectively.

 

Andrej Kocen
6 years ago Aug 28, 2015 11:09am