Skip to Content
0
Former Member
Oct 30, 2014 at 12:51 PM

Uncaught TypeError: Cannot read property 'setVisible' of undefined

1122 Views

Im fairly new to SAPUI5 and when I click on button I get the error in the title what I did in Is I used the SAP web IDE to create new MVC project .

in the main view JS I put

createContent : function(oController) {

var btn = new sap.m.Button({ id:"myBtn", text : "Content Button" }); return new sap.m.Page({ title: "TitleT", content: [ btn ] }); 

}

in the Main controller JS I put the following code

onInit: function() { var that = this; window.setTimeout(function() { that.byId("myBtn").setVisible(true); }, Math.random() * 10000); }, onPress: function() { this.byId("pressMeButton").setText("I got pressed");