How to implement 'HTML Renderer'

Hi there,
working with Jmix 2.4 I have the following problem. Want to make a Text-Renderer with HTML:

@Supply(to = "usersDataGrid.communications", subject = "renderer")
private Renderer<User> usersDataGridRenderer() {
    return new TextRenderer<>(user ->
    {
        String text = user.getEmail() + "<br>" + user.getPhone1() + "<br>" + user.getPhone2();
        return String.valueOf(new Html( text ));
    });
}

produces something like: com.vaadin.flow.component.Html@46b46375
in the cell.
Thanks for your advice,
br
HP

Hello!

Take a look at LitRenderer, it allows you to define HTML template and bind properties from entity with template variables:

@Supply(to = "usersDataGrid.communications", subject = "renderer")
private Renderer<User> usersDataGridRenderer() {
    return LitRenderer.<User>of("${email}<br>${phone1}<br>${phone2}")
            .withProperty("email", User::getEmail)
            .withProperty("phone1", User::getPhone1)
            .withProperty("phone2", User::getPhone2);
}

Hi Roman,
thanks for your advice.
We just had to add “item. …” before the keys, then it worked.
("${item.email}
${item.phone1}
${item.phone2}")
Thanks,
HP