Page Refresh after a DB Update

In perspective, on updating a table in data base on a button click on a view that displays the table with a query binding, the table doesn’t show the updated data! I want to refresh the page showing the updated table. I found a refresh query binding method in the documentation as follows:

self .refreshBinding( "props.data" )

But how to give the path to the binding!? The view is embedded inside a flex container whose instance is bound to the query.

Will refreshing the view not trigger the query once again? How to refresh the view (or page for that matter, if its not too expensive)

You need to use refreshBinding() on the component that has the binding. How you get that component is up to you, If you are trying to update a component inside an embedded view from outside of it, I suspect that you would need to use system.perspective.sendMessage() with a message handler on the embedded view. Probably on the table but doesn’t have to be.

Then you can use some method of acquiring a reference to the component.

Some variant of self.parent.getChild('ComponentName').refreshBinding('props.data')

4 Likes

Yes that’s it! Sending message and calling refreshBinding works just fine! I first tried refreshing the page but it does refresh the whole page with a blink but doesn’t update the binding! Thanks a lot!

By the way how to achieve the same in vision pages?

In vision you can use system.db.refresh() which despite the “db” will refresh any binding.

Thanks, will try and update you. But will it update all query bindings? That would be too expensive!

No you have to pass a reference to the component and property

1 Like

ok, got it, thanks a lot.