我正在尝试使用Vaadin创建网格,并且无法显示数据源内的数据。数据源定义如下所示
public class Customer {
private String name;
private List<Contacts> contacts;
}
public class Contacts {
private String phonecontact;
private String emailcontact;
}
现在我编写代码以使用Vaadin显示数据
private Grid<Customer> grid=new Grid<>(Customer.class);
grid.setItems(createCutromers());
...............
..............
private List<Customer> createCutromers(){
List<Customer> customerList=new ArrayList<>();
Customer cust=new Customer();
cust.setName("Rocky");
Contacts cont=new Contacts();
List<Contacts> contactsList=new ArrayList();
cont.setEmailcontact("wwww");cont.setPhonecontact("212");
contactsList.add(cont);
cust.setContacts(contactsList);
customerList.add(cust);
return customerList;
}
现在我想在Grid中显示名称和联系人,我应该怎么做呢?问题是List显示为Object。什么是最简单的方法。
输出应该像
name | phonecontact | emailcontacts
-----------------------------------------
Rocky | 212 | www