Page.getCurrent().reload() logining out

Hi all,
I’m using Page.getCurrent().reload() with @Push anotation, it truely reloads the page, but it seems that it killing the vaadin session or something because it asking user to relogin after that.
Please suggest me something, fighting third day with this…

Hi Suvorov
What do you wish to do? The reload() method will indeed completely reload the page and start a new session.
If you wish to refresh the data displayed in the page then you will need to write a method that does that and call it.
Cheers
Sean

Could you please give me some link to example or something, I’m not familiar with Vaadin almost at all :frowning:
Look, my needs is quite simple, I just need to refresh Grid (with BeanItemContainer inside) with fresh data from server.
For that purpose I’m using next method with @Push anotation on my UI class:

private void reloadContainer(final List<Instrument> instruments) {
    this.executor.submit(new Runnable() {
        @Override
        public void run() {
            UI.getCurrent().access(new Runnable() {
                @Override
                public void run() {
                    gridContainer.removeAllItems();
                    gridContainer.addAll(instruments);
                    paging.updateInfoComponents();
                    Page.getCurrent().reload();
                }
            });
        }
    });
}

Found solution, just added @PreserveOnRefresh anotation to my UI class

Hi Suvorov
Well done. I just updated the BeanItemContainer and the bound UI widgets (such as Grids) update automatically.
I am not sure why you need to do a reload().
Cheers
Sean

You don’t have to and should not reload the page to refresh the data.
It should update automatically with push (and if it doesn’t there is an issue somewhere that must be solved).

Yes, thank you a lot. Now it works with @Push(PushMode.MANUAL) anotation on my custom UI class and UI.getCurrent().push() method in place where I need to refresh my grid.
Horaay!! :slight_smile: