Pull-to-refresh page

Hi,
I followed this tutorial to enable pull-to-refresh in this way:
Capture

But when I pull down, a new page starts instead of refreshing the existing one!

How do I solve it?

Hey,

Yes only using Open page will just open the page as you said. You’ll need to set the logic for what you want to happen when the page is pulled, e.g. request new data and set it to the data variables. Depends really on what you want to happen :slight_smile:

1 Like

Thanks Cecilia for your reply :slight_smile:
What I want it to happen is that when I drag down, then the existing page is updated. In the same way as it does on most apps.
Can you please explain a little more to a beginner :frowning:

So what do you want updated when you refresh a page? What content do you want updated? For example Instagram’s and facebook refresh the feed and a news app refreshes the articles when pulled down. That means that the news app fetches its data again in case there would be some new articles to show. If you are using data resources and data variables, you would make a new Get collection request and set the data variable with the new results. You can see the logic canvas for your data variables to check out the logic loop for getting data with Get Collection and Set data variable.

For more info on the logic for data variables check out here :slight_smile:

1 Like

Thanks again Cecilia :slight_smile:
I do not use data resources and data variables.
I use web view on a page that contains news that is updated.

How to refresh a page that contains dynamic data?

Hey,

Sorry for not following up on this! There is no direct way to refresh the contents of a webview, that would mean somehow controlling and refreshing the page that the webview is displaying, and that is not possible through an app. I might have a hacky way to get this done:

  • Set the URL in the webview as a page variable and bind that to the url property of webview
  • After the Pull-to-refresh event, add a Set page variable function for the page variable, and set the value as the same url

This might work for the webview to reload with the same url. If it doesn’t, you could also try using two Set page variable functions in a chain and first set the url to empty and then right after set the url value again, as in the screeshot below:


Thank you Cecilia for your answer :slight_smile:
I created this variable webview_url, but I can not bind that to the url property of webview

Set the variable as a URL type, not text :slight_smile:

I tried it too, but it failed!

Ah sorry it’s supposed Web URL and not URL!

Now it was possible to bind variables to the url property of webview :slight_smile:
But when I start the page with webview, so it is completely blank.
When I pull to refresh, then the page is visible in webview and the content is updated properly :slight_smile:
Why does webview show nothing when I start the page?

Ah probably because the page variable doesn’t have a value until you set it with the pull to refresh. In the webview url property, you can add the following formula: DEFAULT(pageVars.webview_url, "the url here") so before refreshing it will still default to use the same url :slight_smile: this is a bit confusing maybe and hacky, but should work :grin:

1 Like

It works, you are amazing Cecilia :slight_smile:

1 Like