Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

editable table

Mariam Abou-Elfadl
1 decade ago Apr 03, 2010 9:49pm
Joonas Lehtinen
1 decade ago Apr 04, 2010 7:37am

Table editMode is quite limited:

  • There is no good way of forcing the textfields in the table to be immediate - events will be sent when something else communicates with the server (one scrolls table for example)
  • There is no listener in the table directly for listening to value change events in the container properties.

Here is a simple example on how to construct a container outside the table and listen to property changes in that.

IndexedContainer container = new IndexedContainer();
        container.addContainerProperty("name", String.class, "");
        for (int i = 0; i < 500; i++) {
            Integer rowid = new Integer(i);
            container.addItem(rowid);
            container.getContainerProperty(rowid, "name").setValue("Row " + i);
        }
        container.addListener(new Property.ValueChangeListener() {
            public void valueChange(ValueChangeEvent event) {
                Property p = event.getProperty();
                mainWindow.showNotification("A row was changed to " + p);
            }
        });
        Table t = new Table(null, container);
        t.setEditable(true);

Because editMode is quite limited, you might want to consider not using it and using a generated column instead.

Last updated on Apr, 4th 2010
Mariam Abou-Elfadl
1 decade ago Apr 05, 2010 11:40am
Joonas Lehtinen
1 decade ago Apr 05, 2010 11:44am