Skip to Content
avatar image
Former Member

auto update of image


I'm about to have a first go on UI5 and what I'm trying to do sounds rather simple to me - yet I haven't succeedet yet. Maybe someone of the comunity my be able to point me in the right direction?

My situation: I have a URL that points to my image. The URL stays the same, just the image is constantly repainted. I would like to update this new image in my view.

What I did do is the following:

I created a view and a model. The model contains the URL to the image

var dataObject = {             "src" : "",         }; var oModel = new sap.ui.model.json.JSONModel(); oModel.setData(dataObject); sap.ui.getCore().setModel(oModel);

Then I bound this model to an image:

var myImage = new sap.m.Image("i1");


Then I've added this image to a page and display this page in my app.

var page = new sap.m.Page({ title: "image", content:  myImage, });

The result is, that the app shows the very first image but will never update the content.

How would I trigger the repeating update of this image?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Jan 12, 2015 at 10:04 AM

    If the URL doesn't change I think you will run into browser caching issues.

    Many thanks,


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Jason

      I believe this should not be an issue. If I auto reload the whole page, I keep getting an updated image( e.g via <meta http-equiv="refresh" content="1" >)

      But this is not a clean way to solve the issue and I keep looking for a solution that just updates the image object.

  • Jan 14, 2015 at 07:20 AM

    HI Bernd

    The image control is unable to know that the image that is referenced by the URL is changed. So you need a timer to refresh the model with a different URL to notify the image to render. You can add some random string to the URL to make the URL different from the previous one. e.g.<uuid>

    and this will also avoid browser caching your image.

    Here is an example with icon.


    Add comment
    10|10000 characters needed characters exceeded