TreeGrid not working on Vaadin 13

I am using TreeGrid in Vaadin 13, It shows only parents not their Childrens when I am not setting Hierarchy Column and when I setHierarchyColumn it will not show any item in the Grid not parents not their childerns.

following is my code of creating TreeGrid.

private void createGrid() {
        populateTreeSamples();
        sampleGrid.setItems(treeSamples , TempTreeSample::getChilderns);

        sampleGrid.addColumn(p -> p.getFormatedId()).setHeader("Sample").setId("sample");
        sampleGrid.addColumn(p -> p.getDrawDate() != null ? p.getDrawDate().toLocalDate().toString() : null)
                .setHeader("Draw Date");
        sampleGrid.addColumn(TempTreeSample::getCreateDate).setHeader("Log Date");
        sampleGrid.addColumn(p -> p.getSpecimenType() != null ? p.getSpecimenType().getDescription() : null).setHeader("Type");
        sampleGrid.addColumn(TempTreeSample::getNumberOfTubes).setHeader("#");
        sampleGrid.addColumn(p -> p.getSampleInvalidReason() != null ? p.getSampleInvalidReason().getDescription() : null).setHeader("Description");
        sampleGrid.addColumn(p -> p.getSampleCode() != null ? p.getSampleCode().getDescription() : null).setHeader("Sample Type");
        sampleGrid.addColumn(p -> p.getComment()).setHeader("Comment");
        sampleGrid.addColumn(p -> p.getDiscardDate()).setHeader("Discard");
        sampleGrid.addColumn(p -> "").setHeader("Extracte");
        sampleGrid.addColumn(p -> p.getDiagnosis() != null ? p.getDiagnosis() : null).setHeader("Diagnosis");
        sampleGrid.addColumn(p -> p.getCreateBy()).setHeader("Logged By");
        sampleGrid.addColumn(p -> p.getUserField1()).setHeader("UserField 1");
        sampleGrid.addColumn(p -> p.getUserField2()).setHeader("UserField 2");

//        sampleGrid.setHierarchyColumn("sample");
    }

3 Months and no answer so far ? I have the same Problem. Migrating from Vaadin 8 → 13 broke the functionality of the TreeGrid for me.

Nevermind, somehow it is working now. Just changed the first column to a HierarchyColumn.

Can you show how you are creating the TreeGrid instance (sampleGrid in this case)?

Have you noticed that the JavaDoc for [setHierarchyColumn()]
(https://vaadin.com/api/platform/13.0.9/com/vaadin/flow/component/treegrid/TreeGrid.html#setHierarchyColumn-java.lang.String-) has this note?

Note: This method can only be used for a TreeGrid created from a bean type with TreeGrid(Class).

Maybe you’d like to use [addHierarchyColumn()]
(https://vaadin.com/api/platform/13.0.9/com/vaadin/flow/component/treegrid/TreeGrid.html#addHierarchyColumn-com.vaadin.flow.function.ValueProvider-) instead like in the TreeGrid demos at https://vaadin.com/components/vaadin-grid/java-examples/treegrid?

I’m pretty new to this Java API myself (I’m more familiar with the JavaScript side), just trying to give some hints on why it might not have worked for you.