Refreshing the web block on Parent screen in Mobile development

Hi Everyone,

I am not able to refresh the web block on the parent screen. So the scenario is as follow:

I have a web block(it has a country and state local storage as an input parameter) on the home page which displays the Country and state of the user. If I want to change the country and state I go to the settings page and select the new Country and state(this updates the local storage of the user's country and state) but when I go back to the homepage the web block displays the previous Country and state while it should be displaying the newly selected value. Do I need to trigger any block event for the latest value?? Please help!!

Thanks & Regards,

Shivya Pant

Hi Shivya,

Changes you make in a weblock do not automatically propagate to the parent webblock or screen.

You have to trigger an event in the webblock for which you then have to add the eventhandler in the parent webblock or screen to handle the change.

Please check the folowing document : https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Reuse_UI/Use_Events_to_Propagate_Changes_From_a_Block_to_the_Parent

Regards,

Daniel

Daniël Kuhlmann wrote:

Hi Shivya,

Changes you make in a weblock do not automatically propagate to the parent webblock or screen.

You have to trigger an event in the webblock for which you then have to add the eventhandler in the parent webblock or screen to handle the change.

Please check the folowing document : https://success.outsystems.com/Documentation/11/Developing_an_Application/Design_UI/Reuse_UI/Use_Events_to_Propagate_Changes_From_a_Block_to_the_Parent

Regards,

Daniel


Hi Daniel,

Thanks for your response. So the catch here is the settings page where I can change the country and state is not a web block. But the home page where I display the country and region is the web block. So how can I refresh the data in the web block on the home page? I have read that the data automatically gets refreshed when you render the screen again but it is not happening.

Thanks & Regards,

Shivya Pant


Your description mentions

  • A settings page
  • And the home page that is the webblock --> that sounds weird either it is a page (screen) or a webblock,
    so I asume  you mean the home page has a webblock in which the country and region are shown.

If you change data in the settings screen it will never automatically refresh in the home screen.

What you could do is on the save action of the settings screen change the end node to a destination widget and set  'home page'  as destination, that way the home page is loaded, data retrieved and shown.

To be honest I stil not fully understand how the structure is of your application with how you describe it.

Daniël Kuhlmann wrote:

Your description mentions

  • A settings page
  • And the home page that is the webblock --> that sounds weird either it is a page (screen) or a webblock,
    so I asume  you mean the home page has a webblock in which the country and region are shown.

If you change data in the settings screen it will never automatically refresh in the home screen.

What you could do is on the save action of the settings screen change the end node to a destination widget and set  'home page'  as destination, that way the home page is loaded, data retrieved and shown.

To be honest I stil not fully understand how the structure is of your application with how you describe it.

Hi Daniel,

Thanks again. It is my first time with the mobile app and I am getting a bit confused that is why my architecture seems weird. 

1) So what if I make a web block on the settings page for selecting the country and state with an event triggered. 

2) I will remove the web block and put a conatiner to display the data on the home screen. Will it update the data on the home screen?

3) Also to navigate from the settings to the home screen we have a back icon and no button is being used on the settings page. It is the requirement. 


Thanks & Regards,

Shivya Pant

Solution

Hi Shivya,

I  would advice to follow https://www.outsystems.com/learn/paths/1/becoming-a-mobile-developer/ which is fun to do and you will learn how to build mobile apps. Benefit is that most of what you learn is also relevant for the newly introduced reactive web apps.

That said, Each screen needs to take care it self to retrieve and display data.

  • Settings screen is used by user to change country, I asume the change is saved either on server or loca entity.
  • User presses the back icon to navigate to the home screen
  • Home screen needs to retrieve the data to show.

Now the back button can behave different than you would think, so I would suggest to change the link on the back button to explicitly show the home page. That way it will read its data and show it.

Hope this helps.

Regards,

Daniel


Solution