Non-expanding TreeGrid

Is there some quick trick for getting a non-expanding TreeGrid? I have a short list of hierachical (shallow) elements which I always keep expanded. Other than fiddling with expand/collapse-listeners or editing out stuff with a TemplateRenderer?


If I understood it correctly, you want to have a TreeGrid on which you want to prevent the user from collapsing/expading the items, but instead keep them always opened. I don’t believe there’s an easy way to prevent that.

One way to achieve that, though, could be by using a regular Grid on which you could use [setClassNameGenerator]
( and then style the children accordingly (e.g. by adding padding-left).

Thanks, I’ll have a look at that option

Maybe this helps. Use it instead of the default hierarchical column.

Column<T> column = grid.addColumn(TemplateRenderer.<T>of("<vaadin-grid-tree-toggle leaf='[[item.leaf]
]' expanded='true' level='[[level]
]'>" + "</vaadin-grid-tree-toggle>" + "[[]
                .withProperty("leaf", item -> !grid.getDataCommunicator().hasChildren(item))
                .withProperty("name", value -> String.valueOf(valueProvider.apply(value))));

(Didn’t test it myself, but this is the simply variant of integrating the toggling mechanism manually).