[IGN-9270] Scroll scrollbar to position via script - Perspective?

I noticed in this thread: Scroll scrollbar to position via script that there was a vertical scroll memory for the Vision module but is there one for Perspective?

I think this came up before and the answer was "No".

Thanks for the response. Seems like Perspective module should get it before Vision due to webpage interactions.

What do you mean by this?

Vision has this kind of functionality because jython scripting runs right there in the client, and has full access to the entire Java Swing object model. Perspective does not because its scripting runs in the gateway, and has no access whatsoever to the browser's DOM.

Ahh I see, so what would you suggest I do?

Dive into React. Closely examine the implementation of the target component(s) using React browser utilities. Determine what javascript you might need to cause this UI behavior. Figure out how to inject javascript into Perspective (markdown component is popular for this).

Good luck. None of this is trivial.

2 Likes

It depends on what problem you are trying to solve.
Keep your user experience consistent with normal browsing experience.

Trying to solve scroll memory with System Functions python scripting. The significance of the feature does not justify the time it will take to learn how to inject JS and use it. At leased at this point in my understanding of Ignition.

Sure, but what was the original user requirement? Why did you need to scroll to a position and was it on a view or on a table? You might be able to solve it using a filter to reduce a table's data, for example.

Yeah I did not clarify. I am using a view that has multiple embedded views within it. It will continue to get larger in size as we continue to expand in size. Its basically a snapshot of the entire plant with all of its machines scattered across the page in a vertical layout. Each machine functions as a button that, when clicked, will open its respective page.

Is your goal to set the scroll position, or is your goal to scroll a certain component into view?

... and, I presume, the problem to be solved is how to return to the plant overview in the same position you departed from.

Possible alternatives:

  • Open the machine view in a modal popup.
  • Open the machine view in a new browser tab. The problem with this is that there is no way to close the tab with a button on the view. See Closing browser window from button in perspective? - #6 by PGriffith.
  • Add an embedded view into each of the embedded machine views. Toggle the visibility of this when the machine is selected. (To avoid a performance hit you may need to disable updates on all the collapsed views somehow.)
2 Likes

Remember the scroll position before opening a new page so that when you go back it will place you in the position you were at before

Another thing I noticed that is very annoying and seemingly unfixable (for now) is when you have a table that you scroll to see some value, when the table data refreshes, the scroll position resets to the top. When using the table for anything but the trivial use case (i.e. using a subview or embedded views in the columns), this gets to be a big problem. We literally got another ticket right before I started typing this comment about this issue - our users ask about it all the time.

Those are good ideas. I feel like there is a scripting function that might retain the location on the page then pass it as a param to the new page. Then use a back button with that param value or something

I think you might need to recalibrate your feelings. When were they last checked?

1 Like

I'll have to add a 'feelings check' policy in my next version launch

1 Like

There is a way to manage this - sort of.

If your "navigation" to these Embedded instances was able to pass along a domId value, or use a domId from somewhere toward the top of the instance, then when you perform navigation you could use url navigation to specify the id.

system.perspective.navigate(url="<gateway>/data/perspective/client/<projectName>/path/to/page#targetDomId")

This results in the page scrolling to the target by it's unique identifier.

1 Like
  • Named embedded view DomId => "navBack"
  • Clicked on a button within that embedded view which opened a new page
  • added a "Previous Page" button with a onClick event python script:
system.perspective.navigate(url="/data/perspective/client/Machine_Data_View/master-view/#navBack")
  • This just took me back to the TOP of "master-view" which houses that embedded view with the domId I setup earlier. I should mention that the embedded view's location is halfway down the page.

I assume I have the URL syntax wrong

The extra slash is treating that#navBack as a parameter or continuation of the URL. Remove the slash.

4 Likes