Matheus Duque
Matheus Duque

Reputation: 13

vaadin 23 how do i get my grid to autoupdate every few minutes?

I'm new to vaadin and currently I'm doing this project at work and have to make a grid autoupdate from the database, can anyone help me?

I've looked around for documentation and tried using TimeTask but it did not work.

Upvotes: 0

Views: 127

Answers (1)

ollitietavainen
ollitietavainen

Reputation: 4275

You need to enable Push in your application in order to send asynchronous updates to the client. Here, asynchronous means something that doesn't happen because the browser sends a request to the server, so for example something that is executed with a timer.

In Vaadin 23, enabling Push is done by adding the @Push annotation on a class that implements AppShellConfigurator, typically the Application class. Updates from a background thread need to use the ui.access() method to avoid conflicts in the session. There are configuration options for using Push that you can find from the documentation: https://vaadin.com/docs/latest/advanced/server-push

Upvotes: 1

Related Questions