I need to change a parameter inside a template that is inside a template repeater
templates = system.gui.getParentWindow(event).getRootContainer().getComponent('Template Repeater').getComponents()
for template in templates:
template.setPropertyValue("status", False)
On the first line I get all the templates inside the repeater, but when I try to write the property inside the template I get errors like this:AttributeError: 'com.inductiveautomation.factorypmi.application.com' object has no attribute 'setPropertyValue'
This is not the correct way to get the templates from a repeater. You need to use the loadedTemplates
property:
repeater = event.source.parent.getComponent('Template Repeater')
for template in repeater.loadedTemplates:
If the property you are trying to set is a custom property, you will probably need to dig it out of the template's dynamicProps
field.
Here is an example from another post:
Update row in template repeater using button (outside from template) click
Thanks, I just end using:
templates = system.gui.getParentWindow(event).getRootContainer().getComponent('Template Repeater').getLoadedTemplates()