DataGrid SelectMode=MULTI does not offer any handlers for the checkboxes for advanced operations

DataGrid SelectMode=MULTI does not offer any handlers for the checkboxes for advanced operations:
https://demo.jmix.io/ui-samples/sample/data-grid-selection-mode

It would be great getting the same events and handlers for the datagrid checkbox similar to the normal checkbox:
https://demo.jmix.io/ui-samples/sample/checkbox-dataaware

Hi,

Could you please describe in more detail what exactly events you need from the checkbox?

DataGrid provides selection listener and select methods (both to select a single item or a collection of items) which are replacements for value change and setValue.

Regards,
Gleb

When I use the JMix IDE, it does not offer any selection listener methods:
image

Additionally, I would need the ability to disable checkboxes for the parents and some children in a TreeDatagrid once a checkbox was selected.

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:

  1. com.vaadin.flow.data.selection.MultiSelectionEvent
  2. 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