I’m a newbie with Vaadin and Java. I’m trying to autorefresh my table for when there are new data in DB.
I saw there is Refresher plugin which of old releases and I have read that for Vaadin 7 I have to use setPollInterval().
Therefore In my mainUI class, I have written this:
setContent(mainLayout);
UI.setPollInterval(1000);
Why isn’t it working me? Is this enough to refresh my table? Do you have some example where I can see how to refresh a table?
Hmm. The polling will just make the clientside refresh to match the server-side UI state - the table doesn’t know to automatically refresh itself from the database unless you tell it to do so. How to do this depends on how you fetch the data in the first place, but one option is to add a poll listener with UI.addPollListener.
setPollInterval(5000);
addPollListener(new UIEvents.PollListener() {
@Override
public void poll(UIEvents.PollEvent event) {
System.out.println("Hola");
updateTableData();
}
});
Thanks a lot! If you come to Barcelona someday, I will invite you for a few beers!
ok… I have another problem… I think I’m a little bit tiresome hehe
I got to refresh my table, that’s ok but I’m refreshing all components so that that’s is a problem for me because I have a window component with a form. When I open that window to create a new data or to edit a old data and the ui refreshes I lose the action I was doing.
Is there some different way to do that refreshing only the table?