
<core:View xmlns:core="sap.ui.core" xmlns:common="sap.ui.commons" controllerName="buttontutorial.view.simple">
<common:Button text="Load Image" id="jerryButton" press="onPress"/>
<common:Image id="jerryImage"
height="400px"
width="400px"/>
</core:View>
sap.ui.define(["sap/ui/core/mvc/Controller"], function(Controller){
"use strict";
return Controller.extend("buttontutorial.view.simple",{
BIG_IMAGE: "https://cloud.githubusercontent.com/assets/5669954/24836808/7d78976e-1d58-11e7-9c28-2c76d90c9e12.png",
onPress: function(){
var image = this.byId("jerryImage");
this.loadImageNormal(image);
},
loadImageNormal: function(image){
image.setSrc(this.BIG_IMAGE);
}
});
}
);
sap.ui.define(["sap/ui/core/mvc/Controller"], function(Controller){
"use strict";
return Controller.extend("buttontutorial.view.simple",{
BIG_IMAGE: "https://cloud.githubusercontent.com/assets/5669954/24836808/7d78976e-1d58-11e7-9c28-2c76d90c9e12.png",
onPress: function(){
var image = this.byId("jerryImage");
this.loadImageWithProxy(image);
},
injectProxy: (function(){
var imgProxy = new Image();
return function(img, src){
imgProxy.onload = function(){
img.setSrc(this.src);
};
img.setSrc("buttontutorial/view/loading.gif");
imgProxy.src = this.BIG_IMAGE;
};
})(),
loadImageWithProxy: function(image){
this.injectProxy(image);
}
});
}
);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
5 | |
5 | |
5 |