Looping through Perspective Flex Repeater bindings

I’ve got a bunch of dropdown views in a flex repeater. Each option has a db query binding.

I want to refresh them on receipt of a message so I’m using this script.

	for inst in self.props.instances:
		system.perspective.print(inst.caption)   # Prints the dropdown label.
		system.perspective.print(inst)      # Print the binding object.
		inst.refreshBinding("ddOptions")  # Update the dropdown param binding.

It prints the label caption and the binding object for the first dropdown view but doesn’t do the rest of them.

What have I missed?

refreshBinding is a Component-scoped function, not a property-scoped function. So you would use it like so:

for x in range(len(self.props.instances)):
    self.refreshBinding('props.instances[{0}].ddOptions'.format(x))

where self is a reference to the component while in a Message Handler.

That works, thanks! I’m not familiar with that syntax so I’ll have to study it.

Was that a quick midnight forum check before you get some sleep? I’m in Ireland so you got my day off to a good start.

Yes, It was, actually. :rofl:

The syntax boils down to obtaining a Perspective component to act on, and then providing the path of the binding to refresh. If you need to update a binding on a different component, you can do that as well:

self.getSibling('SiblingTable').refreshBinding('props.data')