Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Grid with multiple editors per column
I have a grid that displays numbers in a column - so far so good. Now there are numbers that can be freely edited - but in the same column there are numbers that are bound to a specific set of numbers, i.e. these numbers I would like to edit using a combobox.
Is there a way to achieve this?
any help is appreciated
Yes, it is possible. You can bind your custom FieldGroup to a grid that allows you to define different field types even though the data type is the same.
FieldGroup fieldGroup = new FieldGroup(); fieldGroup.bind(new TextField(), "integerValueA"); fieldGroup.bind(new ComboBox(), "someOtherInteger"); grid.setEditorFieldGroup(fieldGroup);
thanks for your answer, but as I see correctly the fieldGroup binds different Components to different propertyIds. What I want to achieve is to bind a specific component that depends "on the state" of the property, for example:
if the property X is a number -> TextField
it the property X is bound to some values -> ComboBox.
My problem is, that it is always the same property.
I don't think there is an elegant solution. Workaround could be to create your own CustomField that changes its content based on the value.