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.
bind data to a combo
In a Form I have a combo defined in this way:
IndexedContainer ic = fillMyContainer();
ComboBox comboBox = new ComboBox("My combo",ic );
comboBox.setItemCaptionPropertyId("description");
comboBox.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
comboBox.setWidth(250, UNITS_PIXELS);
comboBox.setFilteringMode(Filtering.FILTERINGMODE_STARTSWITH);
comboBox.setImmediate(true);
comboBox.setNullSelectionAllowed(false);
addField("combo",comboBox);
I use the Form to insert new records (displaying it empty) or to edit old records. In inserting mode the combo works well and on commit() I get the value selected in the combo.
In edit mode, when I bind my bean to the Form, the combo doesn't display the "description" property, even though it is filled and if I pull I find all my items. I bind my bean to the Form in this way (code from incubator spring):
public void rebind(Object bean) {
if(bean == null) {
throw new IllegalArgumentException("Bean can't be null");
}
beanItem = new BeanItem(bean, getItemPropertyIds());
for(Object propertyId : getItemPropertyIds()) {
Field field = getField(propertyId);
field.setPropertyDataSource(beanItem.getItemProperty(propertyId));
}
}
How can I have my combo filled in edit mode?
Thanks in advance, Francesco
Solved! Class used in the Select component must implement the equals method. Without equals method, Select results blank.
Francesco
Francesco M: Solved! Class used in the Select component must implement the equals method. Without equals method, Select results blank.
Francesco
Francesco, how do you have implemented the equals method? Im with the exacty same problem, as you can see in this post: http://vaadin.com/forum/-/message_boards/message/275486
Ive implemented the equals method, invoking the equals of the superclass. Latter, I override the method, with the ckeck of Ids of the entitys, also return true case it is equals, but I dont works anyway.
I will really apreciate any help!
Many Thanks.