How to refresh binding after clicking button on popup

I am working on a project and have a confirmation popup with information to be entered. The button then commits data to database and another popup opens with success or fail message and an ok button. On the confirmation popup after click of the button I'd like to refresh binding on previous page table. I have looked at system.perspective.refresh, can't get the right pageId, Caused by: java.lang.IllegalArgumentException: Page "EMBEDED\Scheduler..." not found. I set pathId variable to the path of the page in the above error message.

You can achieve this easy with message handlers..

Right click on your table or the thing you want to refresh to add your refresh script under configure scripts. For example

self.refreshBinding("props.data")

Then on your confirmation button fire that script. For example

system.perspective.sendMessage(messageType='Refresh Table',payload={},scope='page')

https://docs.inductiveautomation.com/display/DOC81/Component+Message+Handlers

Thank you very much! That's what I needed.

Note that "self" needs to be for the component that has the binding you want refreshed.
So if the you had a button component and wanted to refresh a binding on a property for table component named "myTable", you might need to do something like:

In the button's onActionPerformed() handler:

tblSelf = self.getSibling("MyTable")
tblSelf.refreshBinding("props.data")

getSibling might need to be replace with what ever pathing to get from the button to the table.

Using messages and handlers as craigb suggests would allow you to avoid the component pathing, but I often find it's overkill.

HTH.
-Shane

1 Like

Thanks!