Menu tree help for a new programmer!

Hello all,

I am trying to figure out how to add a script on a menu tree that will allow the user to click on any one of the menu tree buttons and they will be taken to a page 'Alarms'. The script will then automatically type some text into a text box on the page 'Alarms' to filter the results shown on that page. e.g. A1, A2, A3.

Attached is a picture of the menu tree as well as the code that is currently in there that does not work. Any help or push in the right direction is appreciated!

snip1

Post code, not pictures of code, see Wiki - how to post code on this forum. It helps others who want to copy your code to test.

Looking at your code there are multiple issues:

  • The first line under the method definition is not properly indented. Also, why are you trying to assign the event object to a custom property?
  • Navigation.GoToPage doesn't exist in Ignition. system.perspective.navigate is the correct builtin method. Not sure where you managed to get that from.
  • Does your root container have a custom method called showPage? What does it do and why are you calling it?
  • Why are you building the full path string to the selected item to not use it? (Your entire for loop)
  • You assign event.target to a variable, but then use both the assigned variable and event.target later in code.

Where is the script supposed to grab the text that you want to type into the alarm page?

One way to approach this is to use the params argument of system.perspective.navigate to pass the filter term to the view via a view parameter while navigating to your Alarms page.

3 Likes