PDA

View Full Version : How to bind a column with a nested property inside a model bean



Aldo Laiseca
24 Oct 2009, 12:32 AM
Hi, I have a couple of classes like these:

class Payment {
int id;
Date date;
Customer customer;
...
}

class Customer {
String name;
String address;
...
}

I have a store list of Payments (obtained from a query). I want to display this list in a grid. I need to show the customer's name in a column in this grid. So far, all the examples I've seen to associate a column with a bean property correspond to single properties. But in this case I have a property which is part of another object which in turn is a property of the model bean. I tried the following code:

List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig("customer.name", "Customer name", 180); configs.add(column);

but it doesn't work. Any help on how to do this? Thanks in advance

alacenaire
26 Oct 2009, 1:32 AM
Perhaps you can try with a special column render