TreeDataGrid with menu, view and button

i had TreeDataGrid of menu and view (i created it with data collection in MenuItem):
image_2024-02-28_143005745
but, now i wan’t create to TreeDataGrid of menu, view and button, such as below:
after
I don’t know where to find the buttons of the views in the system (according to the parent-child relationship). Can any one help me?
Thanks for read!

Hello,

What version of Jmix are you using?
Can you clarify, do you want to create a TreeDataGrid column with a button that would navigate to the view by its id?

Regards,
Sergey

Hi Sergey,
I’m using jmix 2.1.2. I want to create a TreeDataGrid column that have menu, views and all button in that view (only to view, no need navigate to the view by it’s id).
Regards,
TienNH

You can use ComponentRenderer in your TreeDataGrid to achieve this.

    @Autowired
    private UiComponents uiComponents;

    @Supply(to = "demoEntityDataGrid.comment", subject = "renderer")
    private Renderer<DemoEntity> demoEntityDataGridCommentRenderer() {
        return new ComponentRenderer<>(value -> {
            String comment = value.getComment();
            if (comment == null || comment.startsWith("button")) {
                Button button = uiComponents.create(Button.class);
                button.setText((comment != null) ? comment : "default");
                return button;
            } else {
                Span span = uiComponents.create(Span.class);
                span.setText(comment);
                return span;
            }
        });
    }