cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud - set default image (404) for XML view tag.

0 Kudos
136

Hello!

How can I set default image (not found) for <image> tag?

my view.xml:

<Image id="__image0">

my controller.js:

this.getView().byId("__image0").setSrc(repoUrl);

This works perfectly, exept 404 case - no image found by that link.

I know one option -

new sap.m.Image({  
src: "ACTUAL IMAGE PATH",  
alt: "test image",  
decorative: false,  
error: function(){  this.setSrc("ERROR IMAGE PATH");  } 
 });

But I want use <image> from XML view.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

XML:

<Image error="onImageError" id="__image0"/>

JS:

onImageError: function(oEvent){ this.getView().byId("__image0").setSrc(Url); },