-
I just started converting an app to use hash routing. I have a situation like this:
From the examples I have seen, people tend to have multiple template forms that are used depending on the user privileges. So they avoid the issue I'm having by creating multiple template forms and not needing to trigger events in a template form from a route form. Here's what I did before routing: def load_component(self, cmpt):
self.cmpt = cmpt
self.content_panel.clear()
self.content_panel.add_component(cmpt)
cmpt.add_event_handler('x-refresh', self.refresh_links) How would I add this event handler in a hash routing setup? Are the template forms and route forms even linked this way behind the scenes? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Figured it out - I add the refresh event in the on_navigation and on_form_load methods in the template form. I also made sure to use the load_from_cache=False option when using routing.set_url_hash() to trigger these. |
Beta Was this translation helpful? Give feedback.
-
Bumping this to ask the question more generally - is it possible to raise an event in a template form from the route form? |
Beta Was this translation helpful? Give feedback.
Might feel a bit hacky. But the template form is the form you would get from calling
get_open_form()
and you can all that from anywhere in your app. Just make sure it happens after the show event or from user actions.