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.

How to bind whole Bean from Combobox to BeanItemContainer ??

Deleted User
6 years ago May 25, 2015 2:03pm
Matti Tahvonen
6 years ago May 26, 2015 1:42pm

Hi,

Why are you calling "container.addNestedContainerBean("role");" ? I think you should just "replace" that property with a combobox select in edit mode (when reading you can count on toString or customize the string presentation).

cheers,
matti
 

Deleted User
6 years ago May 26, 2015 2:52pm
Matti Tahvonen
6 years ago May 26, 2015 3:04pm

So removing  "container.addNestedContainerBean("role");" made it work? 

In the ComboBox you can naturally use the setItemCaptionPropertyId that you had used before as well. And to avoid toString usage for normal (read only) representation you can use getColumn("role").setConverter(Converter) to avoid Grid doing toString for the Role object in your User objects that are listed in Grid. Using toString is no hack if it happens to give you a decent presentation, but it sure is not what you want most of the time :-)

BTW. If you want to have handy way to customize the text presentation of objects listed in the ComboBox, you should check out TypedSelect from Viritin add-on. It has a concept called CaptionGenerator that makes customizing the caption really easy - right as you want it. That is my regular solution ;-)

cheers,
matti
 

Deleted User
6 years ago May 26, 2015 3:25pm
Deleted User
6 years ago May 27, 2015 11:20am

there is one more thinng... When I changed something on editor's combobox it automaticaly refresh coresponding field on the grid's row.

But when I edit aTextField - gid is not updated, but underlying datasource is changed in the same way like in the case of combobox.

How to refresh entire grid's row after commit editor's changes to datasource?

Noel Makumuli
6 years ago Nov 20, 2015 5:12am
Matti Tahvonen
6 years ago Nov 20, 2015 6:10am
Noel Makumuli
6 years ago Nov 23, 2015 9:03am