Adding the SelectionListener
doesn’t work in both studio and framework. This occurs because the method doesn’t fit the standard definition of a method signature for a subscribe-method. A base subscribe-method has only 1 parameter, which implements eventObject
.
For example:
@Subscribe("usersDataGrid")
public void onDataGridSelect(SelectionEvent<DataGrid<User>, User> event) {
// do nothing
}
com.vaadin.flow.data.selection.SelectionEvent
doesn’t implement eventObject
, so the method can’t be resolved.
The SelectionEvent
has two inheritors which extend eventObject
:
com.vaadin.flow.data.selection.MultiSelectionEvent
com.vaadin.flow.data.selection.SingleSelectionEvent
However, for these particular events there are no methods to add. It must be added with io.jmix.flowui.component.grid.DataGrid#addSelectionListener
.
Thus, the problem can’t be solved right now, so selection listener can be added only by injecting DataGrid
and invoking addSelectionListener
merhod.
Gleb