Problem with tutorial about Table : no row printed.

I’ve tried many solutions found in forum, without success : cannot print the table’s rows.

While SelectList works fine, no way to find out the problem from this code copy/past from Book of Vaadin 6.4 (2010-07-08 ) :

[font=Courier New]
import com.vaadin.Application;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;

/** @author cl-r * 14 sept. 2011 */
public class ApprentissageApplication extends Application {
@Override
public void init() {
final Window mainWindow = new Window(“Learning Application”);
setMainWindow(mainWindow);
final Table tableNeurone = new Table(“Test”);
tableNeurone.setVisible(true);
tableNeurone.addContainerProperty(“Col1”, String.class, null);
tableNeurone.addContainerProperty(“Col2”, String.class, null);
tableNeurone.addItem(new Object{“1”, “2”});
tableNeurone.addItem(new Object{“11”, “12”});
tableNeurone.setImmediate(true);
mainWindow.addComponent(tableNeurone);
}
}
[/font]

I’m working on Eclipse Indigo 7.0, Tomcat v7.0 and Vaadin 6.6.6.

I need help (correct/complete this code will be helpful) !

Best regards
cl-r

You are using addItem(Object itemId), not addItem(Object item, Object itemId).

You need to do add an item ID as the second parameter, for example an integer as follows:

tableNeurone.addItem(new Object[]{"1", "2"}, 1);
tableNeurone.addItem(new Object[]{"11", "12"}, 2);

The addItem(Object, Object) is essentially a shorthand for calling

// Again use an integer item ID or just leave it out to have it automatic
Item item = table.addItem(1);
item.getItemProperty("Col1").setValue("Foo");

for each of the property values given in the array.

[u]

[/u]Thousand thanks for your very clear and rapid response.
Managing Property is not obvious for a newbie in Web application, your post help to understand usage of it.

Best regards from PARIS
cl-r