Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9159

Re: How to call a function in a controller from different function which is in same controller

$
0
0

Hi Nandanoor,

 

We can't do declarations in controller.

 

addNum : function(){

  var imgTemplate = new sap.m.Image({

  src:{

  path:"title",

  formatter:function(element){

  return ('images/'+element+'.png');

  }

  },

  width: '50%',

  height:'50%'

  });

  jsonmodel.getData().push({title:'3'});

  var mytiles = new sap.m.CustomTile({content: imgTemplate,press : addNum()});

  vertbox.bindAggregation("items","/",mytiles);

  vertbox.setModel(jsonmodel);

  }

 

 

In the above,

 

  var imgTemplate = new sap.m.Image({.....................................

  var mytiles = new sap.m.CustomTile({content: imgTemplate,press : addNum()});

 

You declared in controller. You have to declare in view only and you have to call them to do any functionality from view  by using some ocontroller.someFunction(); like this.....

 

And another thing is you didn't pass jsonmodel from view to controller...

You can directly write that in view, no need to write in controller i.e.   jsonmodel.getData().push({title:'3'});


Viewing all articles
Browse latest Browse all 9159

Trending Articles