Refreshing data of a Table...

Hi all,

I have created my own Table class (say MyDataTable), extending from the
com.vaadin.ui.Table
.
In my default constructor, I have set
enableContentRefreshing(true);

Then later on I get some new data for the table & set them. After that I call
myTable.requestRepaint();


public void insertNewDataToTable(HashMap<Long, Object[]> newData){
		myTable.removeAllItems();
		for(long key : newData.keySet()){
			dataGrid.addItem(newData.get(key), key);
		}
		myTable.requestRepaint();
	}

But still nothing happens.

Can someone please tell me what’s wrong here & is there a way of getting my table refreshed after I get new data into my table?

Thanks in advance,
Asela.

Hi,

Where is your insertNewDataToTable() called from? Is it called from a background thread or from a UI event?

Hi Henry,

It’s called from a background Thread.

The scenario is as follows.

  1. I instantiate the table & fill in some initial data
  2. Then I generate some new data in my Thread class
  3. Next I clear the contents of my table
  4. And I try to fill that new data into the table

Thanks,
Asela.

All communication between the server and browser goes like this: browser->server->browser. As all your changes are initialized from the server side, nothing gets pushed to the browser before the user clicks something that causes a server roundtrip. You need either the
Refresher
component, that updates the view with a certain interval, or
ICEPush
component, that will push changes to the browser when you ask it to.

Hi Jens,

I used the
Refresher
component & it worked like a charm. :slight_smile:

Thanks.
Asela.

Hello, i have a same problem.
Do you post a example of the use the refresher with table?
Thanks

I fix using as BeanItemContainer.
see this http://vaadin.com/forum/-/message_boards/message/198662

Thanks.