ActionHandler_OnPullToRefreshTrigger why raise event again? - MobApp

ActionHandler_OnPullToRefreshTrigger why raise event again? - MobApp

  

hi community,

I am wondering, try the:

When i pull down the screen, it shows "halo". My question is why in the action handle, the event OnPullToRefresh is reraise again? Isn't it that event has been raised when we pulldown our finger on the screen?

regards,

indra

  

Hi Indra,


You should not change the action handler from the layout because is the layout mechanism to implement the on pull refresh.


Your must create a screen, go to the layout and create a new action handler:



Then implement in this new handler the logic you need.




I send an example attached.


Cheers,

Renato


Indra Budiantho wrote:

hi community,

I am wondering, i use Dublin template, then try the:

When i pull down the screen, it shows "halo". My question is why in the action handle, the event OnPullToRefresh is reraise again? Isn't it that event has been raised when we pulldown our finger on the screen?

regards,

indra

  




Solution

Indra, just want to clarify what is that "raise event" that was confusing you. I also suggest you to watch this lesson: https://www.outsystems.com/learn/lesson/807/blocks-and-events/


The raise event invokes an action that is outside of the scope of the current block. So you are looking at the Layout block, which is used in all screens of your app. However, when you pull down to refresh, each screen will have its own logic. For example, in an ecommerce app, some screens would refresh the list of products, other screens would refresh the shopping cart items, other screens might refresh your wishlist items.

So you cannot define this logic inside the Layout block - because it will be different depending on the screen. That's what the event allows you to do - you just raise an event, and each screen will provide the implementation logic of that event. In this case, the event is optional - meaning that some screens won't execute anything at all.


If you change that action inside the Layout block to include that "halo" message, you will see that the message will appear in every screen (only when you activate the pull to refresh). That's because the same block is used in every screen, and you're changing it.

Solution