What I’m trying to do:
I’m trying to reload the page
What I’ve tried and what’s not working:
self.refresh_data_bindings()
What I’m trying to do:
I’m trying to reload the page
What I’ve tried and what’s not working:
self.refresh_data_bindings()
self.refresh_data_bindings()
is used when the data bound to frontend components changes. Eg. if your Label component is bound to data[“name”], then you’d want to call self.refresh_data_bindings()
whenever data[“name”] changes. So it does not necessarily reload the page, only the bound components. To reload the page, you could either use the anvil anvil.server.reset_session()
or use Javascript window.location.reload().
There may be better ways of achieving this that others may know but the foregoing is what I’ve been doing.
I’m not convinced that reloading the page is the actual goal, but there’s no information given on what the original poster is trying to achieve. It could be that they just want to reload a repeating panel
I’d suggest the OP give a lot more detail on the form they have, and what they’re actually trying to accomplish.
Use open_form() with the name of the page. Opening a page from the same page will reload it:
open_form('Form1')
Strictly speaking, it will create a new instance of class Form1
and show it. The old instance will be destroyed when there are no more references to it from elsewhere.
Because they are two distinct instances, they won’t share any instance variables. Information will not automatically be transferred from one instance to the next.
This helped me at least
# logout button
def button_1_click(self, **event_args):
from anvil.js.window import location
anvil.users.logout()
location.reload()