I have BeanItemContainer which I would like to bind as a data source in my table.
BeanItemContainer has inside bean within is an array.
How could I do this ?
Below is my bean (POJO) within is nested the array:
[code]
package …
import java.io.Serializable;
public class EmployeesListPOJO implements Serializable
{
private EmployeesArray[] employeesArray;
public EmployeesArray[] getEmployeesArray()
{
return employeesArray;
}
public void setEmployeesArray (EmployeesArray[] employeesArray)
{
this.employeesArray = employeesArray;
}
public EmployeesListPOJO(){
}
}
[/code]And here’s my attempt to bind it to the table:
BeanItemContainer<EmployeesListPOJO> container = new BeanItemContainer<EmployeesListPOJO>(EmployeesListPOJO.class);
Table table = new Table();
table.setContainerDataSource(container);
table.setVisibleColumns(new String[] {"employeesArray"});
table.setColumnHeader("employeesArray", "First name", "Last name");
I would like to have two column headers in my table: “First name” and “Last name”
which are associated to fields “firstname” and “lastname” in the array.
Hi Tomasz, did you figure out this? I’m facing the same issue. But what about if you have your POJO with some atribute (creationDate for example) and want to show in table your pojo attribut and nested attribute? creationDate, firstName and Lastname for example.