Vaadin flow 12.0.5 TreeGrid Multiselection Exception

Hi,
I have simply create TreeGrid with Vaadin latest version which have multi selection option. But getting this execption when selecting a item from Grid.
Code:


@Route
public class MainView extends VerticalLayout {
    
    public static class Person {

        private String name;
        private Person parent;

        public String getName() {
            return name;
        }

        public Person getParent() {
            return parent;
        }

        public void setName(String name) {
            this.name = name;
        }

        public void setParent(Person parent) {
            this.parent = parent;
        }

        public Person(String name, Person parent) {
            this.name = name;
            this.parent = parent;
        }

        @Override
        public String toString() {
            return name;
        }
        
    }

    public MainView() {
        TreeGrid<Person> grid = new TreeGrid<>(Person.class);
        grid.setHierarchyColumn("name");
        grid.setSelectionMode(SelectionMode.MULTI);
        
        Person dad = new Person("dad", null);
        Person son = new Person("son", dad);
        Person daughter = new Person("daughter", dad);
        List<Person> all = Arrays.asList(dad, son, daughter);
        
        all.forEach(p -> grid.getTreeData().addItem(p.getParent(), p));
        
        add(grid);
        
    }
}


Exception 

Caused by: java.lang.IllegalArgumentException: Hierarchical data provider doesn't support non-hierarchical queries
	at com.vaadin.flow.data.provider.hierarchy.HierarchicalDataProvider.size(HierarchicalDataProvider.java:53)
	at com.vaadin.flow.component.grid.AbstractGridMultiSelectionModel.selectFromClient(AbstractGridMultiSelectionModel.java:101)
	at com.vaadin.flow.component.grid.Grid.select(Grid.java:2513)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.vaadin.flow.server.communication.rpc.PublishedServerEventHandlerRpcHandler.invokeMethod(PublishedServerEventHandlerRpcHandler.java:167)
	... 46 more

Hi Bishwajit,

I run into the same problem. Did you find any solution ?

thanks,
Thorsten

Hi Thorsten,

It looks there is a reported issue which has been fixed in vaadin-grid-flow. you can confirm here https://github.com/vaadin/vaadin-grid-flow/issues/506

I think the next release will include this fix, which will be [3.0.4]
(https://github.com/vaadin/vaadin-grid-flow/milestone/81?closed=1). probably the next Vaadin 13 release will include this also, the version should be 13.0.5.

BR.