TreeGrid multiselect

Hi,

I have a simple tree grid with two (root) items. Multiselection is enable. If I select both entries through UI, the “select all” checkbox is only partially check - is this expect? I would expect that the “select all” checkbox is ticked. See screenshot below.

image

Thanks.

        var grid = new TreeGrid<>(Test.class, true);
        grid.setSelectionMode(Grid.SelectionMode.MULTI);
        var treeData = new TreeData<Test>();
        treeData.addRootItems(new Test(1));
        treeData.addRootItems(new Test(2));
        grid.setDataProvider(new TreeDataProvider<>(treeData));
        add(grid);

public class Test {
    Integer id;

    public Test(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }
}

Hello @ondrej_exp,

Thank you for feedback. In Vaadin 25, a new HierarchyFormat.FLATTENED data provider format was added, which should make this scenario possible to support. I’ve opened a ticket: [TreeGrid] Support determinate SelectAll state when using HierarchyFormat.FLATTENED · Issue #8306 · vaadin/flow-components · GitHub

In Vaadin 24, it’s unfortunately unlikely to be supported due to the architectural limitations in Tree Grid.

1 Like