Table content not shown

HI,i have created a simple table and added some values to it.Problem is that it is showing the table but not the values which i have added.Thanks

Table table = new Table(“Patient Data”);
table.addContainerProperty(“Name”, String.class, null);
table.addContainerProperty(“Location”, String.class, null);
table.addContainerProperty(“SSN”, String.class, null);
table.addContainerProperty(“Age”,Integer.class , null);

	table.addItem(new Object[]{"Tim","room 453","2343-654",new Integer(21)});
	table.addItem(new Object[]{"Isaac","room 4051","546-876",new Integer(14)});
	table.addItem(new Object[]{"Galileo","room 354","2345-564",new Integer(36)});
	table.addItem(new Object[]{"Mark","room 954","45675-98",new Integer(27)});
	table.addItem(new Object[]{"John","room 394","45675-567",new Integer(18)});
	table.addItem(new Object[]{"Tom","room 34","5679-987X",new Integer(29)});


change the addItem-calls to this:

Item item = table.addItem("TIM");
item.getItemProperty("Location").setValue("room 453");
item.getItemProperty("Age").setValue(new Integer(21));


This will work.

The parameter of addItem() is only the unique object-id. In your case you must fill the property for display by hand.
Alternatively you can use a BeanItemContainer and add this to table.


Someone should fix the documentation then, because this is exactly written like that in the book of vaadin.

The documentation is correct. You just forgot to set the id when adding an item.
So it should be:

table.addItem(new Object[]{"Tim","room 453","2343-654",new Integer(21)}, new Integer(1));

Notice the last new Integer().