Vaadin: Auto-refresh Grid (ajax-like)

1.4k views Asked by At

Vaadin 7.4 introduced Grid, a brand-new component to display tabular data. In my application I have a view that contains a Grid. The grid is populated with a dynamic data (there is a rest service that populates the grid container).

enter image description here

That said, I need to auto-refresh the grid time to time Ajax-like (just the grid, without refreshing the whole window). Is that possible with the Grid component?

1

There are 1 answers

0
Henri Kerola On

Applications written with Vaadin are totally dynamic, which means that the framework makes sure that only updated parts (components) are redrawn when something is modified on the page. All the communication in Vaadin happens by using AJAX requests.

This means that if you update the data in your Grid, only the Grid will be redrawn, not the whole page.

If you get some kind of event about the update on the server, then you just could update the Grid with the new data and enable push or polling to see the changes in the browser too.

If you need to poll changes on your data source, then you should create an external thread for that and use push or polling to see changes in the browser.

When an external thread is modifying your Vaadin component instances, then you need to use UI.access to ensure correct synchronization.