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'});