Update a table without remove items

I’m a newey in Vaadin and have a question.

I need a table that can retrieve data form a mysql database.

The problem is that everytime my table refreshes, it blinks, is there a way that i can refresh the table without having blinks?

There are 2 functions in Vaadin “setImmediate” and “markasdirty” but dont know how to arrange the functions in my code:

Table automatictable = new Table();
Timer timer = new Timer():
..... etc ...
run() {
     updateTable(); //every 3 secs

updateTable() {
   while {
       // add rows


to refresh table you can use these 2 methods


I dont know how you bind data to your table, if you use cached container then you will have to refresh it too before redrawing your table.

The method setImmediate(boolean) has nothing to do with this - it tells whether the client (browser) should send events (like editing a value or changing the selection) to the server as soon as they happen or whether it is ok to wait until there is another event on which the first one can be “piggy-backed.” A non-immediate event might still be sent immediately, this is only a hint for the client.

If you are updating the container in the background, make sure you are doing synchronization or locking correctly - see
this thread
. You need a push or pull to get the changes to the client when they happen, but maybe you already have that set up.

For Vaadin 7 locking (replacing synchronization on Vaadin 6 Application instance), see VaadinSession.lock()/unlock() - the class Application that is mentioned in the thread above does not exist anymore.

Even small mistakes in synchronization/locking can lead to occasional strange errors that are very hard to find, so best follow a common pattern very carefully (below for Vaadin 7):

// all this in the background thread inside the main loop or in timer code
data = fetchDataFromDBOrOtherLongOperationNotTouchingUIClasses();
try {
} finally {

If you are forcing the table to refresh, you basically guarantee it needs to be redrawn completely. If you only use the addItem(…) etc. methods of the container and let the container handle notifying the table, some containers might be able to send more specific updates to the Table saying that only these rows have been added, though at least in most cases a full refresh of the contents is performed.

Thanks to everybody… it helped :slight_smile: