Force refresh on perspective mobile doesn't work

Hi,

I'm using v8.1.36. I've a page showing data from DB. If i do some changes in the DB with SSMS, and try to refresh the page on the mobile (swipe down + hold 2 seconds), i see that it reload but it doesn't refresh data from the DB. I've seen similar posts from few years ago, but none really had a solution.

Many people say to create an onStartup script to refresh my binding, but the onStartup event is not triggered by this swipe down + 2 sec. I've added a button calling my custom method to refresh my binding, and it work just fine.

Any idea what could cause this?

thanks

Bindings will re-evaluate when the value they are bound to changes. For things like Named Queries, this happens only when a parameter of the Named Query supplied as part of the binding has changed, or the polling period has elapsed. The refreshBinding(...) component method will force the binding to re-evaluate.

Refreshing your Page doesn't trigger the onStartup Event for the Page, because the onStartup Event only executes when a Page is first created for the session. Note that I said Page - not View. The View onStartup only executes when the View is created in the DOM. you might be able to get away with placing a refreshBinding(...) invocation in the View onStartup Event, but why would you expect your user to refresh their page? Provide your user some UI - like a button - so that they have a visible cue that refreshing data is possible.

This all really depends on how often you expect DB data to update, and I don't know your use-case. This scenario seems like an example where you want your data "now". If so, you might want to set the Named Query to have a polling rate of only a few seconds.

2 Likes

you are right. In development i know that i did some changes in the DB but in production, it should check periodically for new data so it should be tied to a name query with a polling period. So i'll stick with this method and forget about the swipe. So we can consider this case closed.

But just for curiosity, i've tested to put the script on the event onStartup of the View and tested the Swipe Down + 2 sec old. I've added a line which should put an entry "Mobile Refreshing" on the gateway log. I see this "Mobile Refreshing" on our log only on the first page load.

Swipe down + 2 sec hold doesn't add any line to the log except these:

I've tried to refresh (F5, or CTRL-F5) the same app on Google Chrome on a PC, and it doesn't fire the onStartup event too.

I kind of suspected it wouldn't. The View isn't technically "starting up" again; from the Gateway's point-of-view the View was always part of the Page - there was just a network hiccup.

2 Likes