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.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
ComboBox - table datasource when using option caption
I am populating the ComboBox with a datasource table (value int, visible_value String).
But when I do form.setIemDataSource() the value does not show up.
Then, when I do not use the visible_value then it populates on selecting a row.
So with visible_value the combobox is not populating.
cb = new ComboBox("tit");
cb.setItemCaption(value); // this works ok
And I try this:
cb = new ComboBox("tit");
cb.setItemCaption(value, (String) visible_value); // this does not work
Question: Is there a programatic way to select a item from combobox when using the visible_value ?
The table I have is myvideo ( value int, visible_value String):
value visible_value
1 GO_TO_MOVIE
2 GET_DVD
3 RENT_VIDEO
Create a simple form, a table and ComboBox to recreate this. Have a split panel with top panel showing form and bottom panel showing the table list. When you select a row in list panel the top form panel shows the combobox.
Also related post is http://vaadin.com/forum/-/message_boards/message/16840?_19_redirect=%2Fforum%2F-%2Fmessage_boards%2Fsearch%3F_19_redirect%3D%252Fforum%252F-%252Fmessage_boards%252Fcategory%252F11566%26_19_breadcrumbsCategoryId%3D11566%26_19_searchCategoryId%3D11566%26_19_tabs1TabsScroll%3D%26_19_keywords%3Dselect%2Boption%2Bvalue
Please find attached the zip file having a simple application with just one form showing the problem in "cities" drop down. I used the Person and PersonContainer from the vaadin tutorial.
Hi!
setItemCaption(Object itemId, String caption) should work. Make sure that you actually are using the *item id* and not the item when calling this method.
If this was not the problem, could you please provide a test case (small application) that shows the error?
HTH,
/Jonatan
I attached the zip file which shows the problem I am encountering.
Problem solved: It was my mistake in the application code.
When doing setitem the data type should match.
Once I did that the vaadin app runs fine - it properly populates from the database datasource...
case closed.