Browser page reload #2588
Replies: 1 comment
-
I apologize for my html/javascript ignorance! After a few hours of google searches and testing, I have one solutions to my question: # Add custom event
ui.add_head_html('''
<body onload="myFunction()">
<script>
function myFunction() {
emitEvent('pageReload');
}
</script>
''') Your listen for the custom event as follows: ui.on('pageReload', self.pageReload) Then add the following method to your class: def pageReload(self):
tournamentTeamsWindow.RELOADCOUNTER +=1
if tournamentTeamsWindow.RELOADCOUNTER >= 1:
print("page Reloaded")
self.toggleButtons(rowSelected=False) Better alternatives? Please let me know! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Any user can execute page reload via the browser controls. Is this a standard nicegui event or do I have to add a custom javascript event to the page? Can some one point me to example code? Thanks!
Beta Was this translation helpful? Give feedback.
All reactions