ComboBox multicolumn

Hello,
can i use a ComboBox with more than one column??
I try with:
ComboBox cBa = new ComboBox(“Select”, SelectContainer.getData());
cBa.setItemCaptionPropertyId(new Object { “CodSelect”, “Description” });
No errors are raised and ComboBox are showing the number of elements but no item are visible.

Thanks

No, this is not supported by the ComboBox component.

What you are doing is trying to use the array instance as a property ID. There is no matching property, so the combo will look empty.

The client side implementation of ComboBox is actually quite complex - partly because of lazy loading, partly because of behavioral differences between browsers and partly for historical reasons. However, you might be able to “simulate” a combo box to some extent with a text field and a button that opens a popup view containing a table. You could also take a look at
PopupButton
add-on, which might (with some customization) match your needs.

I never created a control that you suggest, could you do me a small diagram of the classes to be implemented to do this?
Thanks.

from your question
i intuit that you do not really want separate columns
but a display in the drop down menu
which combines the data from two columns for “cosmetic” purposes
in this case to give an explanation (Description) of the meaning of the code (CodSelect)

this is possible
but the downside is that input into the text box
will find from the beginning of the displayed text
thus you need to consider the relationship
between the text displayed in the dropdown menu
and that (if any) likely to be entered into the text box by users

so for example in my case
i am querying a relational data base
and getting back a list of a DAO class of type Scheme
which then populates the combox dropdown menu

				relatedconceptSelection.removeAllItems();

				for (Scheme scheme : sqlService.getAllowedSchemes(type, name))
					{
						relatedconceptSelection.addItem(scheme);
					}

it appears that the addItem method
when setting the text to display in the dropdown menu
defaults to the toString method of the class
thus it is possible to “override” the definition of the toString method of the class
and return any string you wish
thus you could concatenate something like:

return Description + " --- " + CodSelect

or
return CodSelect + " — " + Description

or in fact any string you feel like
depending on considerations such as mentioned above
then when the user selects a string from the menu
the appropriate instance of the class Scheme (in my case) is returned

i hope my intuition is correct
but i fear far too late anyway
perhaps this may still be of use to somebody

in addition
if your requirement is indeed as i have suggested
then you may also wish to make the text appear as two vertical columns
regardless of the length of the text in each part

setting the combobox dropdown text to Courier or somesuch helps

then this message may help
https://vaadin.com/forum/-/message_boards/view_message/1087871

Hello everyone, I’ve got an question that refers to this ticket.

Iis it possible to show up a Combobox with two columns only or not?

I intent to show a Text and an additional short description.

I’m new in Vaadin development, and won’t break the rules of this forum, so I’ll hope that this question fit into the common obligations to notify.

Best regards Daniel.