Problem:
When the browser "back" button is selected (Chrome Browser), none of the startup scripts run on the views (or page).
Forum Solution (previous posts)
Use a change script on a custom value bound to a session prop.
My issue
I cannot seem to find (in the manual or testing) a session prop that changes when the back button on a browser is hit.
Alternatives
I have tried a few things, but most all require a script to run. Which won't on nav back from browser.
Thanks for the patience and help.
I haven't used this before, but there is a general page startup script within the 'Session Events'
Maybe try shooting a message down with the system.perspective.sendMessage()
function with the page path in the payload and checking against it in a handler to trigger any startup actions in the desired view. Again, I have not attempted this so I'm not 100% sure it'd work, but it seems worth a shot
Hopefully, you will not run into the same issue as with the startup scripts.
Attempted variations:
Session events:
Startup: scope page and then scope session
Page Startup: scope session and scope page
Neither would actually fire on page loads, only on session login (so fires for each session not each page load).
I am willing to try anything.
1 Like
pturmel
December 17, 2024, 3:26pm
4
Add a shared dock view to your project, so it is present everywhere.
In that view, create a custom property that binds to page.props.primaryView
. Add a change event script to that. It will catch most navigation.
1 Like
And if you don't have any use for it you can set one of its dimensions to one pixel.
1 Like
I actually am using a docked view and need it to refresh with a param for content.
Steps I tried:
1- create a view and param (identity), create custom prop that is bound to primary view with load call (send message)
2- create a breakpoint container and link step 1 view, add input param and link to view param.
3- add docked view with the identity param.
This will load on nav back, but not pass the needed docked view param.
pturmel
December 17, 2024, 4:25pm
7
A docked view is only ever started once per page, and parameters are only updated at view startup. Add another custom property to your docked view and unidirectionally bind it to your parameter. That will make it start up correctly. For all other operations, write to the custom property.
I actually had 2 issues (for anyone coming after me that wants to save a little sanity)
@ptrurmel was SPOT ON!
adding the bidirectional binding to the param and the change script to a custom prop bound to the view, worked perfectly.
Side note, payloads come in as a long, not an int. So that took me a min to figure out.
Seriously, thank you!