Refresh table data in all perspective sessions

Hi,

I have a view that displays table data, and this data is updated frequently from different screens. There are multiple active sessions open that use this same view.

I want all of those sessions to refresh whenever the table data is updated.

Right now, I’m using a message handler on root of the view that refreshes the table by calling the refreshBinding() function.

any idea how to refresh all the sessions?

Thanks!!!

If you call a gateway message handler, then use it to call the session message handlers, you can call a refresh from any session. This should let you refresh anything you need within the client scope.

Thanks for your response!!!

How to do this?
I am not sure about gateway message Handler and session message handler.

  1. system.util.sendMessage to send the message to all active sessions.

  2. Create a message handler and have that message handler call
    system.perspective.sendMessage using a message string like refresh-components.

  3. Add a Component Message Handler to each component that you would want to refresh, and have them listen for that refresh-components message. have that run some code like self.refreshBinding("props.text") or self.refreshBinding("props.value"), depending on the component & binding you are refreshing

I understood 2nd and 3rd step, but for step 1 I have doubt, where to write system.util.sendMessage?

In whatever script that would trigger the components to refresh. So in your case, when the data is updated.

If the data is updated by an external source outside of Ignition, you could use the Webdev module to have a POST request trigger the refresh. Otherwise, you might want to have a query tag refresh at a regular interval and have these table components bind their data that one tag. This will reduce your total amount of queries being executed.

2 Likes