Hello, I'm trying to make a grid:
protected void initialize()
{
LayoutContainer container = new LayoutContainer();
container.setLayout(new FitLayout());
ContentPanel cp = new ContentPanel();
cp.setHeading("Test");
cp.setSize(800, 600);
List<ColumnConfig> columns= new ArrayList<ColumnConfig>();
ColumnConfig firstNameColumn= new ColumnConfig("firstname","FirstName",200);
columns.add(firstNameColumn);
ColumnConfig lastNameColumn= new ColumnConfig("lastname","LastName",200);
columns.add(lastNameColumn);
ColumnModel columnmodel=new ColumnModel(columns);
ListStore<Person> ls=new ListStore<Person>();
List<Person> lp=getPersons();
ls.add(lp);
Grid<Person> grid = new Grid<Person>(ls,columnmodel);
grid.setBorders(true);
cp.add(grid);
container.add(cp, new FitData(50));
}
private List<Person> getPersons()
{
List<Person> p=new ArrayList<Person>();
Person person;
person=new Person();
person.setFirstName("FirstName");
person.setLastName("LastName");
p.add(person);
person=new Person();
person.setFirstName("FirstName2");
person.setLastName("LastName2");
p.add(person);
return p;
}
Class Person extends BaseModel.
Problem is that columns headers and data isn't shown together. I mean,
when I start application,there are shown only names of columns of grid, and no data. It may be a bit strange,but when I write: grid.setHideHeaders(true), data without headers is shown then. I'm new,so I don't know what problem may be in. I'll be very pleased if you could help me.