Access Grid editor bean data in addStatusChangeListener

Hi there,

Is there any way to get the current read bean from the addStatusChangeListener event?

List<ObjectNode> inputData = new ArrayList<>();

ListDataProvider<ObjectNode> dataProvider = new ListDataProvider<>(inputData);
Grid<ObjectNode> grid = new Grid<>(dataProvider);
grid.getEditor().setEnabled(true);
Binder<ObjectNode> binder = grid.getEditor().getBinder();

...
ComboBox<String> fieldSelect = new ComboBox<>();
...

binder.addStatusChangeListener(event -> {

	// or event.getBinder().getBean() ?
	fieldSelect.setItems(createRowIndividualComboList(event.getBean()));

});

I want to set an individual list for each ComboBox, but I have no idea how to get the current read data of the editor.
And I want to keep the buffered editor mode.

Best regards,
Sebastian

P.S.: Vaadin version: 8.7.2

One way to get currently edited bean is the getEditor().addOpenListener(…) and use EditorOpenEvent

https://vaadin.com/api/framework/8.8.1/com/vaadin/ui/components/grid/EditorOpenEvent.html

Tatu Lund:
One way to get currently edited bean is the getEditor().addOpenListener(…) and use EditorOpenEvent

https://vaadin.com/api/framework/8.8.1/com/vaadin/ui/components/grid/EditorOpenEvent.html

Hi Tatu,

Thank you for the tip!

Will this opening event triggered before or after the status change event?

Best regards,
Sebastian

Will this opening event triggered before or after the status change event?

Definitely before, since you get it when you open the editor and start editing. The status change is emited later when validation statuses change when you edit.

Tatu Lund:

Will this opening event triggered before or after the status change event?

Definitely before, since you get it when you open the editor and start editing. The status change is emited later when validation statuses change when you edit.

I just checked it now. Sadly this seemed no to be the case.
Are there any other possibilities to retrieve the bean value, so that I can generate an individual ComboBox list?
If I could get the changed (buffered) bean would be even better.

// first this is triggered three times (I have this listener for three ComboBox elements)
grid.getEditor().getBinder().addStatusChangeListener(event -> { ... });

// then this is triggered
grid.getEditor().addOpenListener(event -> { ... });