SilkUI Menu Block - data update

SilkUI Menu Block - data update

  

Hi all,

I'm fairly new to Outsystems, so I might just miss something obvious. However, I the following problem:

I have a Mobile App, and a Screen where a User can update the Profile Picture.

I also have a modified version of the SilkUI Menu Block (including the MenuIcon Block, etc.)

The new Profile Pic should show up when I open the Menu, but this only happens when I "render" the Screen again (i.e. go to a different Screen), not immediately after I changed the Profile Pic and stay on that Screen. Not sure if that's relevant, but the image is saved in a Local Database as binary data.

So, how can I achieve that the picture in the menu shows up when it has been changed on the page?

Thanks a lot!

Hi Marco,

I'm assuming you are using an aggregate to fetch the local image to show in the image widget.

Refresh the aggregate after change/save the image so it fetches the new image. This will trigger the render of the image (it should).

If this does not work, show how you're setting the image widget and the logic to save the image.

Cheers

P.S. Assuming the aggregate is inside the menu block, the easiest will be to have a dummy input parameter in the menu block (boolean), that you invert (through not) every time you change the image. This will trigger the OnParametersChange event of the block, where you will be able to refresh the aggregate.

Hi Eduardo,

thank you so much for your quick reply.

I was thinking along the lines for an input parameter as well, however, I think the problem I have is that can't see a way to "access" the input parameter of the Menu Block from the Screen I'm using.

Since I'm new to this, I have only made small changes to built-in blocks  (e.g. the Layout Block I use for the Screen). So the Menu-Block is somewhat "encapsulated" (for the lack of a better word) in the Layout Block.

On the Screen itself, I think I've done everything as it should be; I only have an Upload Widget, where I call the "CreateOrUpdate" Client Action on the "onChange" Event. The Image Widget is then just showing the uploaded image


I hope this makes sense :)

Thanks again!



Solution

Hi Marco

If you add an Input Parameter to a block, and associate the OnParametersChange event to a screen action inside the block, when you put the Menu in the screen you need to provide a value for this Input Parameter.

Just create a local variable to the screen and associate with the menu.
When you change the value of the variable, it will trigger the OnParametersChange event.

In the client action associated with the event, you refresh the aggregate.

This should do the trick.

Solution

Hi Eduardo,

just wanted to let you know that your suggestion worked. Many thanks for pointing me in the right direction!

I can see that the Boolean input parameter changes whenever I change the logo or type a different username on the Screen. In the "onParameterChangedAction" of the Menu Block I refresh the local "GetProfile" Aggregate, and when I use a Message-Widget I can see that the Current Profile has the e.g. updated username.

The only problem is that neither the updated logo nor username appear on the Menu :)

But I will have to doublecheck what goes wrong there....

Again, thanks for your help.