adding sub property to grid

How can we use the property from another class inside the class we are using in the grid ?

grid.addColumn(“”).setHeader(“Parent Company”).setAutoWidth(true).setSortable(true);

@Table(name = “Company”)
public class Company {
@Column(name = “company_id”, nullable = false)
private Integer id;

@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "parent_company_id")
private Company  parentCompanyId;


How do you mean that,?

I want to use the id from parentcompanyid object.

That’s no problem. Just use the addColumn method with the ValueProvider:


how to handle null value for parentCompanyId ?

Simply add an if in the lambda

grid.addColumn(c-> {
if (c.partnerCompanyId != null) {
} else {
  return "";