Still brings me to the top of the page using:
system.perspective.navigate(url="/data/perspective/client/Machine_Data_View/master-view#navBack")
Still brings me to the top of the page using:
system.perspective.navigate(url="/data/perspective/client/Machine_Data_View/master-view#navBack")
Ah, I missed that you're not supplying the Gateway address. You need to treat this as a full URL. It might work if you change the navigation strategy from URL to page... But I'm confident in the URL approach.
Did this with same result
system.perspective.navigate(url="http://<gateway IP>:<port>/data/perspective/client/Machine_Data_View/master-view#navBack")
I appreciate your help btw
You should use the inspector tool on your browser to verify that the target component in the DOM actually has your expected ID. (And that they are all unique. If duplicate, I believe you will simply get the first one.)
looks like it did not take my "navBack" name.
<div id="coordinateGhost" style="width: 1595.14px; height: 573.04px; z-index: -200000;"></div>
I also tried "coordinateGhost" in my URL and it still brought me to the top of the page.
Edit: I also found this
What is the URL you have configured for this page with your Page Configuration?
This is the main page where I have my embedded view domId configured as "navBack"
http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view
And master-view
is the Primary View configured for that Page Configuration? That's not the name of the Embedded View, is it? I guess what I'm asking is: could you provide a screenshot of the Page Configuration?
master-view is a flex container with embedded views within it:
master-view url:
http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view
I added the domID to the IJ_EmbeddedView:
on a different page I have the back button with the onClick event configured as a python script system function:
system.perspective.navigate(url="http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view#navBack")
Let me know if you need more info
As far as I know, domID goes into META, not PROPS.
Didn't provide the whole pic
Hmmm. After looking at this a bit closer, it seems my usages have all been piggy-backing on browser behavior, and that my suggested approach only works when that sort of navigation occurs while you're already on the page which has the scroll target.
In theory you could put this behavior into place yourself, but it's going to be a bit more complicated.
Whichever Embedded View is navigating to a new page will need to pass along the target domId
value, just like before. Instead of performing URL navigation, you must do page
navigation and pass along the target value as a param.
The MasterView View will need to add a case-sensitive param key at the View node level (not the root
node) with an empty string as the default value. You'll place a change script on this param property which then again performs navigation while targeting the value.
Flow:
param
with a name of scrollTarget
, which has a default value of an empty string.MasterView.params.scrollTarget
has a change script which uses the url
navigation approach ->if currentValue.value: # sneaky check to avoid any action when the value is an empty string
system.perspective.navigate(url="http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view#{0}".format(currentValue.value))
page
navigation and passes along the domId
value of the Embedded View as a param.page
navigation (not url
), and passes the received param back as scrollTarget
.I've opened an internal ticket to get this working during navigation because I would have expected that to work. We shouldn't require you already be on the page with the target.
Yeah I tried using a sendMessage from a different view that had a payload of "navBack". I was able to send it over to the master-view and see the results on a test label, but it did not initiate a change script on the scrollTarget param since I was on a different page. So then I used the same sendMessage function on a button inside the master-view, and it brought me to the proper embedded view scroll location.
messageType = 'scrollTarget'
value = "navBack"
payload = {'key':value}
system.perspective.sendMessage(messageType, payload, scope = 'session' )
def onMessageReceived(self, payload):
#for testing
self.getSibling("testLabel").props.text = payload['key']
#move "navBack" from other view into scrollTarget on master-view param
self.view.params.scrollTarget = payload['key']
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
if currentValue.value: # sneaky check to avoid any action when the value is an empty string
system.perspective.navigate(url="http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view#{0}".format(currentValue.value))
Seems like I was unsuccessful in finding a method to do it from another page.
No, don't send a message, navigate with params.
system.perspective.navigate(url="http://<gatewayIP>:<port>/data/perspective/client/Machine_Data_View/master-view/{0}".format(self.params.scrollTarget))
Your Page Configuration will need to be updated to receive this param:
# new url
/master-view/:scrollTarget
Yeah tried that and then moved on to messages. Using params, I can only get it to work when I am on the same page. If I send a new url param from a different page, the master-view receives the new url param but does not run the change script.