Hi,
Since the table comes by default with an IndexedContainer, I am trying to add an item at a certain position using addItemAt(). The problem is that for some reason, any operation performed on the container directly instead of the table doesn’t work. Here there is a simple example:
[code]
Table testTable = new Table();
Container container = testTable.getContainerDataSource();
testTable.addContainerProperty(“First Name”, String.class, null);
testTable.addContainerProperty(“Last Name”, String.class, null);
container.addContainerProperty(“Location”, String.class, null)
[/code]The columns “First name” and “Last Name” are added to the table, but the column “Location” it is not. What am I missing?
If you take a look at the addContainerProperty in Table, you will see that it adds the property AND shows the column in the table. Container does not
So your column is indeed in the container but table is not displaying it.
Here is the function signature :
/**
* Adds a new property to the table and show it as a visible column.
*
* @param propertyId
* the Id of the proprty.
* @param type
* the class of the property.
* @param defaultValue
* the default value given for all existing items.
* @see com.vaadin.data.Container#addContainerProperty(Object, Class,
* Object)
*/
@Override
public boolean addContainerProperty(Object propertyId, Class<?> type,
Object defaultValue)