Insert at selected position in TreeTable

Hi all,

I am using TreeTable to show a hierarchical entity. I would like to insert newly created records at the selected position of the TreeTable. Any idea how can I do this?

Thanks for your help.

Hello @sambill

New entities are added into TreeTable according their hierarchical property. Could you clarify the task?


Hi Daniil

In the TreeTable, I am selecting a row and click on create button. I managed to configure the editor to consider as parent the selected row. I successfully create a new entry in the hierarchy, however the newly created entry appear at the end of the TreeTable.

Thanks for your help.


I’ve tested the case. New entry is added according hierarchy. The solution is used:

private TreeTable<Department> departmentsTable;
private CreateAction departmentsTableCreate;
private ScreenBuilders screenBuilders;
private Metadata metadata;

public void onInit(InitEvent event) {
    departmentsTableCreate.addActionPerformedListener(e -> {
        Department department = metadata.create(Department.class);

        Screen editor = screenBuilders.editor(departmentsTable)

Could you share test project to investigate the problem?

Hi Daniil,

Interesting, I tried your code and it works. If you try the following, you won’t see the insert at the right position:

    Screen s = screenBuilders.editor(Category.class, this)

Instead of using the TreeTable, I was giving the class object and the controller.

Thanks for your help.