ClassCastException when using GroupDataGrid

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

  1. Is this behavior expected by design?

  2. Is there a recommended abstraction/interface that should be used instead of directly casting to Vaadin Grid?

  3. Are there plans to make GroupDataGrid compatible with standard Grid APIs?

  4. What is the recommended approach for implementing shared generic handling for both DataGrid and GroupDataGrid?

Best regard,

Chee Hao

Hello,

  1. Yes, this is expected. GroupDataGrid is based on a custom io.jmix.groupgridflowui.kit.vaadin.grid.Grid, because grouping support requires changes that are not available in the standard Vaadin Grid.

  2. For shared handling, use Jmix abstractions such as ListDataComponent. If you need grouping-specific operations, use GroupListDataComponent.

    If you need to configure component-specific grid features, you still have to check the actual component type and cast to DataGrid or GroupDataGrid.

    There is also an internal adapter API for GroupDataGrid, used in some framework internals such as AssignGridColumnVisibilityPropertiesInitTask. However, this adapter has limited functionality and is not recommended as a general public solution.

  3. We created an issue in the Vaadin repository to make Grid more extendable:
    Access to the internal API of the Grid [1-2] · Issue #8174 · vaadin/flow-components · GitHub

    If Vaadin fixes the issue, we may be able to remove the custom Grid implementation in the future.

  4. For functionality common to both components, I would use ListDataComponent , and for component-specific configuration, cast to the concrete component type.