Hi Jmix Team,
I encountered a ClassCastException when using GroupDataGrid together with existing generic logic that expects a Vaadin Grid.
Issue
When opening a view containing GroupDataGrid, the following exception occurs:
2026-05-13 11:07:50 [http-nio-8080-exec-6] ERROR i.j.f.e.DefaultUiExceptionHandler - Unhandled exception
java.lang.ClassCastException: class io.jmix.groupgridflowui.component.GroupDataGrid cannot be cast to class com.vaadin.flow.component.grid.Grid
(io.jmix.groupgridflowui.component.GroupDataGrid and com.vaadin.flow.component.grid.Grid are in unnamed module of loader 'app')
Root Cause
GroupDataGrid internally uses:
package io.jmix.groupgridflowui.kit.vaadin.grid;
while standard DataGrid uses:
package com.vaadin.flow.component.grid;
Because of this, the following cast fails:
(Grid<?>) component
when the actual component is GroupDataGrid.
Current Situation
We have reusable generic logic in a base class that works for normal DataGrid, but it fails for GroupDataGrid due to the incompatible grid implementation.
Questions
-
Is this behavior expected by design?
-
Is there a recommended abstraction/interface that should be used instead of directly casting to Vaadin
Grid? -
Are there plans to make
GroupDataGridcompatible with standardGridAPIs? -
What is the recommended approach for implementing shared generic handling for both
DataGridandGroupDataGrid?
Best regard,
Chee Hao