sub_pages_router.on_path_changed #5543
davetapley
started this conversation in
General
Replies: 1 comment
-
|
Hi @davetapley,
It's probably stable, but technically I wouldn't consider it public API. A dedicated change event for
I think this is because there's usually no need for the user to access the router. |
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
Uh oh!
There was an error while loading. Please reload this page.
-
I was about to post asking for a path change callback for a sub pages parent, and that I had a workaround using
ui.onandwindow.navigation.addEventListener("navigate", but when searching the code for the type of theui.oncallback and I see:nicegui/nicegui/elements/sub_pages.js
Line 60 in b1b818d
and:
nicegui/nicegui/sub_pages_router.py
Lines 21 to 22 in b1b818d
Questions:
I don't see it mentioned in the docs, but I assume it's a stable and public API?
Is there any reason it's on
ui.context.client.sub_pages_routerand not accessible from theui.sub_pageselement?I see it's assigned, but doesn't have a public getter:
nicegui/nicegui/elements/sub_pages.py
Line 45 in b1b818d
For context I needed the callback to simplify using a
ui.footerper @falkoschindler 's suggestion here:By doing this I don't have to worry about calling
footer.clear()in sub pages to ensure the previous page's content is cleared out:Beta Was this translation helpful? Give feedback.
All reactions