Hi everyone
,
let’s say I have two simple Entities called Order and Customer. An Order has exactly one Customer (and a Customer can have 0 or more Orders). The entities are defined like this:
@Entity
@Table(name = "orders")
public class Order {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
Long id;
@NotNull
private LocalDate created;
@NotNull
@ManyToOne(targetEntity = Customer.class, optional = false)
private Customer customer;
// Getters and Setters omitted
}
@Entity
@Table(name = "customers")
public class Customer {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
Long id;
@NotBlank
String name;
@NotBlank
@Email
String mail;
// Getters and Setters omitted
}
I would like to use AutoGrid to display all orders. The corresponding OrderService is implemented like this:
@BrowserCallable
@AnonymousAllowed
public class OrderService extends CrudRepositoryService<Order, Long, OrderRepository> {}
If I use AutoGrid like this:
<AutoGrid model={OrderModel} service={OrderService} />
I see the following result:
I would like to configure AutoGrid to display only the name property of the Customer. I tried to set the columnOptions property like this:
<AutoGrid
model={OrderModel}
service={OrderService}
columnOptions={{
customer: {
path: 'name'
}
}}
/>
Unfortunately the result remains the same:
Another thing I tried, was to use the renderer property like this:
<AutoGrid
model={OrderModel}
service={OrderService}
columnOptions={{
customer: {
renderer: ({ item }: {item: Customer}) => <span>{item.name}</span>
}
}}
/>
Unfortunately the result looks like this:
How can I configure AutoGrid to display only the name property of the Customer?
I’m using Hilla 24.4.0.alpha21.



