Updating Template Canvas Data

I’m using a template canvas to display and edit JSON encoded dictionary data. The underlying data source gets updated correctly, but I don’t know how to trigger a refresh based on the users interaction with the templates in the canvas. Currently the template dataset is generated when the user clicks a button, since it needs to grab the JSON data from a database, decode it, and parse the key-value pairs into the parameters of the template dataset.

Can I bind a template property to one in the parent window somehow? Or is there a better way?

I eventually solved this myself. Apparently I didn’t climb the component tree high enough.

Now I’m passing in the following string to be exec’d in a button event inside the template:

	onAddFunction = """template = event.source.parent
key = template.getComponent("txtKey").text
value = template.getComponent("txtValue").text  
shared.db.setPartProperty('%s', key, value)
""" % self.partnumber

Where ‘init’ is a method on the template canvas :slight_smile:

Thanks for posting this solution.