# Perspective Table Binding after Popup Close

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197>\
**Category:** Ignition\
**Created:** [July 26, 2021, 3:13pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197 "2021-07-26T15:13:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyle.bennett](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kyle.bennett](https://forum.inductiveautomation.com/u/kyle.bennett)\
**Post date:** [July 26, 2021, 3:13pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/1 "2021-07-26T15:13:50Z")

</div>

So, I have a table that shows me the results of a named query. When I double click a row, it opens a popup and allows me to edit fields relevant to the record I clicked on. That works fine.

After closing the popup, how do I fire an event to refresh the binding on the table?

I did have an onFocus event on the root container with:  
self.getChild(“Current Users Table”).refreshBinding(“props.data”)

I could have sworn this was working perfectly at one point, but now it isn’t… Anyway, anybody have any ideas?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 26, 2021, 3:19pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/2 "2021-07-26T15:19:46Z")

</div>

Closing the Popup is not necessarily enough to force focus onto the root container.

Your `refreshBinding` usage looks correct, so I would double-check that clicking somewhere in the root container results in the data refresh. If you don’t see it happen, check your Gateway logs to verify your table is a direct child of the root container and that your problem is not the result of a reference path issue.

---

<div class="post-metadata">

**Author:** ![kyle.bennett](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kyle.bennett](https://forum.inductiveautomation.com/u/kyle.bennett)\
**Post date:** [July 26, 2021, 3:23pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/3 "2021-07-26T15:23:41Z")

</div>

Clicking on the table (or even clicking another table on the same view) indeed refreshes the binding.

The desired action though would be that no clicking is required though, is there any way around it?

---

<div class="post-metadata">

**Author:** ![kyle.bennett](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kyle.bennett](https://forum.inductiveautomation.com/u/kyle.bennett)\
**Post date:** [July 26, 2021, 3:27pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/4 "2021-07-26T15:27:03Z")

</div>

Maybe if instead of just closing the popup, I instead use navigation to go back to the view containing the table, which would reload it?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 26, 2021, 3:33pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/5 "2021-07-26T15:33:37Z")

</div>

Yes, but it will require use of Message Handling.

What I recommend in cases like this is dependent on the requirements of the Popup. If the Popup manipulates data in any way, then you should opt to not use the “close icon” (the x in the upper right) and should instead use your own button to close the Popup, This is more in-line with contemporary expectations revolving around a user committing or confirming their changes as opposed to dismissing a popup. The use of a Button allows you to hook into the process, so instead of just closing the Popup you can also place your own code within a script action where you invoke `sendMessage()` before then closing the popup. If your Popup requires the close icon for some reason, you’ll need to use the Message Handler as part of the View onShutdown Event for the View you are using in the Popup.

Message handler invocation:

```auto
system.perspective.sendMessage('update_table', scope='page')
system.perspective.closePopup('YourPopupIdHere')

```

The Table needs to have a listener set up for the message handler you just created. Right-click the Table and select “Configure Scripts”. Add a new handler where the name is “update\_table”, set the scope to be “page” and supply the following code:

```auto
self.refreshBinding('props.data')

```

---

<div class="post-metadata">

**Author:** ![kyle.bennett](https://avatars.discourse-cdn.com/v4/letter/k/71e660/32.png) [@kyle.bennett](https://forum.inductiveautomation.com/u/kyle.bennett)\
**Post date:** [July 26, 2021, 3:40pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/6 "2021-07-26T15:40:11Z")

</div>

That worked perfectly, thanks!

I hadn’t used sendMessage or handlers before, I’ll have to read up on it I suppose.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [July 26, 2021, 4:47pm UTC](https://forum.inductiveautomation.com/t/perspective-table-binding-after-popup-close/49197/7 "2021-07-26T16:47:16Z")

</div>

[Message Handlers](https://docs.inductiveautomation.com/display/DOC81/Component+Message+Handlers) are an amazing resource for communicating in Perspective. The scope of property references (bindings and script usages) is limited to the scope of the View, and is inherently fragile, because any nesting of components at some later time will break the path you’ve defined and result in faulted references.

While Message Handling has some additional overhead when setting up it is incredibly resilient, only prone to breaking if you manage the scope incorrectly, or if you specify the wrong name. Some users encounter issues when they modify the params supplied during the invocation, but that’s a fault of their own code and not the handler itself.

I absolutely recommend reading up on message handlers and using them when you need to communicate between Views, whether they are popups, docked views, or even different pages within a session.
