How can i implement auto refresh on container in Mobile application?

How can i implement auto refresh on container in Mobile application?

  

Hello Team,

I am new to Outsystem development. I am developing a mobile application. I want to refresh a container or a block automatically for every n seconds. 

Regards

Nitesh Pandey


Hello Nitesh,

In mobile, you update data and the UI widgets using this data will be automatically refreshed.

As for updating data every x seconds, I assume you can run a JavaScript that runs an action every X seconds and this action updates your data source (an aggregate for example).

Cheers

Hello Nitesh,

The Outsystems Mobile use Reactjs, and you can update data and widgets automatically without Ajaxrefresh, as  @Eduardo said above.

You can try something like this:

- In your screen, add a new action in your On render (read here about lifecycle screen)

- Add a JavaScript in the flow, in the new action created above

- Add some like this:

setTimeout(function() {
   $actions.YourActionToRefreshData()
   console.log("Test refresh data");
}, 3000);

I think this is what you want. Read more about setTimeout() here.

Just a note: you need to pay attention to the number of requests sent to the server, can cause performance problems.