Issue with calling custom method

I am having issues accessing my custom method from a child component in my view. There is a button event I created in a popup that im using to call my method, but I keep getting an error saying that object has no attribute... Ihave tried the following:

root = self.view.getChild("root")
root = self.view.getChild("Shipping/Views/All Verified Popup").getChild("root")
Neither has worked and im not sure why..


If you use the Browse Properties button (to the right of the script editing text area) you will find that the OK button is disabled when you select the root. It's not a valid option.

Please see Wiki - how to post code on this forum.

1 Like

Always use the component explorer to get your paths. It's in the upper right hand corner of the editor

Write your method as a project script instead and move the script call to onActionPerformed not the onClick one for buttons.

Im actually referencing a project script in the custom method, based on how our code base is set up. Based on documentation I have looked at and my past experience I have had no issue using self.view.getChild().

Perspective Component Methods | Ignition User Manual

Your code base requires you to call a custom method on the root container, just to call another method, rather than just calling the method in question directly? That seems inefficient and hard to follow to say the least.

Either way, I had no issues calling a custom method on the root container using either of the following valid syntax's. I created a custom method newMethod() on a root container, and then added a button to a flex container, inside the root. Then called the method with both versions and was successful.

self.view.getChild('root').newMethod()
self.parent.parent.newMethod()

Either should work.

The property selector will not allow you to select a container, because the intent is the user is selecting a property, however, that doesn't mean that the root container can not be referenced in script. The same is true in Vision.

3 Likes