As stated in the topic, I have an editable grid connected to a bean item container. My bean contains IDs of the values NOT the values themselves (I convert the value based on the user’s locale).
For the values to present, I need to show them as a comboxbox when the grid row is edited. I’ve tried creating a converter for these fields with the object type (KeyValue), but I get conversion errors. So I ripped that out.
Here’s my code:
SourceData container = new BeanItemContainer(SourceData.class,data);
Grid grid = new Grid(container);
grid.setImmediate(true);
grid.setColumns(VISIBLE_COLUMN_IDS);
grid.setEditorEnabled(true);
grid.setEditorBuffered(true);
ComboBox categoryField = new ComboBox();
categoryField.setImmediate(true); categoryField.setNullSelectionAllowed(false); categoryField.setItemCaptionPropertyId(“value”); categoryField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); categoryField.setContainerDataSource(i18n.getCategories()); //BeanItemContainer
grid.getColumn(“dataCategory”).setEditorField(categoryField);
RESULT
Grid shows the data as KEY (as is saved in the database), not the VALUE from the ComboBox beanitemcontainer.
Editing the row, clicking on the combobox (twice), first value is empty, rest of combobox is as expected.
I’m at my wits end.
Help.
Sheila