Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8076

Extending UI5 Image control

$
0
0

Hi,

 

I am trying to add a new property: imageLocation : type String to Image control by doing this:

 

onInit : function (evt) {

 

  sap.ui.commons.Image.extend("Image", {

               metadata: {

                   properties: {

                       "imageLocation": "string"

                         }

                    }

          });

 

Then using it in the code as:

 

  var oImage = new Image({

       width : "190px",

       height : "130px",

       press : function(oEvent){

            var router = new sap.ui.core.UIComponent.getRouterFor(that);

            var context = oEvent.getSource().getBindingContext();

            var path = context.sPath;

            var start = path.lastIndexOf('/')+1;

            var tileIndex = path.substring(start, path.length);

            router.navTo('ViewDetails', {tileIndex : tileIndex});

  }

  });

 

  oImage.setProperty("imageLocation", "{CATEGORY}"); ---> it gives me an error Undefined is not a function.

 

I even used oImage.bindProperty("imageLocation", "{CATEGORY}"); --> same error. CATEGORY is coming from the JSONModel

 

How do I bind the "{CATEGORY}" with the new property I created??

 

Thanks

Prab


Viewing all articles
Browse latest Browse all 8076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>