How to refresh a vaadin page with the refresh button
Asked Answered
K

2

5

I need to refresh the page in vaadin. I created a Refresh Button but the button is not working for refreshing the page.

Button Refresh = new Button("Refresh");
Refresh.addClickListener(new Button.ClickListener() {
    @Override
    public void buttonClick(Button.ClickEvent clickEvent) {
    }
});
Karrah answered 12/9, 2016 at 6:56 Comment(4)
What should happen in the buttonClick() method?Nonalcoholic
@AndréSchild I have creadted a grid in the page i want the grid to refresh again without any changes(search results, sorting ). Buttonclick method should make the page as it was on it's first access.Karrah
Is it a GridLayout or a data grid? Possible duplicate of #32276444 and #29205174Nonalcoholic
In your code you've added a listener for the button, then a method that should do something when tie button is clicked... but the code for this method is empty :(. What do you expect to get if you haven't told him to do anything after the button is clicked?Agma
L
12

Call this in your Button ClickListener:

Page.getCurrent().reload();

This reloads the page in the browser.

Lamblike answered 12/9, 2016 at 8:36 Comment(0)
G
23

For Vaadin 10:

Call this in your Button ClickListener:

    UI.getCurrent().getPage().reload();
Gregorygregrory answered 31/8, 2018 at 9:45 Comment(0)
L
12

Call this in your Button ClickListener:

Page.getCurrent().reload();

This reloads the page in the browser.

Lamblike answered 12/9, 2016 at 8:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.