# Refresh Binding on Table

**URL:** <https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504>\
**Category:** Ignition\
**Tags:** database, perspective\
**Created:** [September 3, 2024, 8:13pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504 "2024-09-03T20:13:02Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 3, 2024, 8:13pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/1 "2024-09-03T20:13:02Z")

</div>

ok, I have a Table `Table_BrassTag` this table has a button `Save` when I click on this button a popup appears, in this popup, I add some data, click on `Save` on popup another popup opens with a confirm and cancel button when I click on the `Confirm` button. The data gets saved into the database via a Message Handler (Thanks to @pascal.fragnoud ).  
Now I want to refresh the binding of `Table_BrassTag` how do I achieve it?

`self.getChild("Tbl_BrassTag").refreshBinding("props.data")`

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 3, 2024, 8:15pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/2 "2024-09-03T20:15:06Z")

</div>

It seems you answered your own question?

> [@Farhan\_Basheer](#):
>
> self.getChild("Tbl\_BrassTag").refreshBinding("props.data")

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [September 3, 2024, 8:17pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/3 "2024-09-03T20:17:09Z")

</div>

I would put a message handler on the table itself with

```python
def onMessageReceived(self, payload):
	# implement your handler here
	self.refreshBinding("props.data")

```

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 3, 2024, 8:18pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/4 "2024-09-03T20:18:59Z")

</div>

It doesn't work actually.

```python
def onMessageReceived(self, payload):
        if q:
            system.db.runPrepUpdate(q, v, database_name)
            self.getChild("Tbl_BrassTag").refreshBinding("props.data")

```

Check the error:

```python
Error running Popup/Add_BrassTag@PL5dgDy-E/root.onMessageReceived(self, payload): Traceback (most recent call last): File "<function:onMessageReceived>", line 28, in onMessageReceived AttributeError: 'NoneType' object has no attribute 'refreshBinding'

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [September 3, 2024, 8:20pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/5 "2024-09-03T20:20:18Z")

</div>

Probably best to follow @Kevin_Flener's advice.

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 3, 2024, 8:25pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/6 "2024-09-03T20:25:21Z")

</div>

Will the table receive the message second popup?  
Table\>Popup1\>Popup2:Confirm, Popup1:Confirm Received\>Table:Confirm Received From Popup2

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [September 3, 2024, 8:29pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/7 "2024-09-03T20:29:26Z")

</div>

It should. I have a delete confirmation popup that sends a message to my table to refresh the data binding and it works as expected.

As long as you have the correct Listen scope.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 4, 2024, 7:09am UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/8 "2024-09-04T07:09:03Z")

</div>

Isn't the message handler that does the database operation on the table ?  
The whole point of my suggestions in the previous threads was to have the message handler on the table.

edit: Actually I guess you have another table in the first popup ? And you put the handler here ?  
Why exactly are there 2 popups ? Shouldn't the first one be enough ?

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [September 4, 2024, 2:47pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/9 "2024-09-04T14:47:57Z")

</div>

This made me believe the message handler was on the container for the table.

```python
self.getChild("Tbl_BrassTag")...

```

If the handler is already on the table then he should just remove that part to make it like this, right?

```python
def onMessageReceived(self, payload):
        if q:
            system.db.runPrepUpdate(q, v, database_name)
            self.refreshBinding("props.data")

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 4, 2024, 2:51pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/10 "2024-09-04T14:51:07Z")

</div>

I think there's another table in the first popup, and that the message handler is there...  
But he wants to refresh the table that's in the base view.

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 4, 2024, 2:51pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/11 "2024-09-04T14:51:44Z")

</div>

The First one is for Inserting the data, the second one is for confirmation.

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 4, 2024, 2:52pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/12 "2024-09-04T14:52:14Z")

</div>

Yes, the message handler is on the container of the Main Table.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [September 4, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/13 "2024-09-04T14:53:19Z")

</div>

Well then you can do `self.refreshBinding('props.data')` right after the db opertation, as suggested above.

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 4, 2024, 6:10pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/14 "2024-09-04T18:10:33Z")

</div>

Exactly.  
So, Main View With Table (View A) to be refreshed. Here we have a button it will open a popup (View B), on this popup we have another table that we will use to insert the data, upon inserting and Pressing Confirm, another popup(View C) will open this will have a Confirm and Cancel Button. When We will click on the Confirm button. Data will be saved into the database via message handler on the Popup One (View B). Once data is Saved, this Popup will be closed and after closing of this Popup (View B) user will be redirected to Main View with Table (View A) I want to refresh the binding of this table as this table is showing the data has been inserted from View B.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 4, 2024, 7:58pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/15 "2024-09-04T19:58:45Z")

</div>

The message handler should be on View A, all of the updating and everything should be done there. When you are done updating the DB, you call `self.refreshBinding('props.data')`.

IMHO, the second popup is needlessly complicating the UI and will become a headache to the user.

Just put the confirm and cancel buttons on the View B popup. If the confirm button is pressed, you send the message to View A and close the popup. If the cancel button is pressed, you just close View B and nothing else happens. There is no reason for the 2nd popup, which is only adding the number of clicks needed by the user to accomplish their goal.

---

<div class="post-metadata">

**Author:** ![Farhan\_Basheer](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/farhan_basheer/32/66759_2.png) [@Farhan\_Basheer](https://forum.inductiveautomation.com/u/Farhan_Basheer)\
**Post date:** [September 5, 2024, 6:48pm UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/16 "2024-09-05T18:48:13Z")

</div>

I am sure your solution is more practical but unfortunately I cannot alter the workflow.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [September 6, 2024, 11:45am UTC](https://forum.inductiveautomation.com/t/refresh-binding-on-table/95504/17 "2024-09-06T11:45:46Z")

</div>

Put aside the fact that the second popup is unneeded.

The message handler should still be on the main view.

Even if you just put an additional message handler on the main view that's only purpose is to refresh the table.
