Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

sap.ui.getCore().byId not working

$
0
0

Hello,

 

I am trying to run a simple program where I set the Label in View and on the controller I am trying to change the label text. I am using the method sap.ui.core.byId() which is not working. This is not working even at the View.

 

Find below my code smapshot -

 

View -

 

var oText = new sap.ui.commons.TextView(this.createId("tv"), { text: "View Text" });
var oButton = new sap.ui.commons.Button(this.createId("button"), { text: "Click Me", press: function() {oController.click()} });
oText.placeAt("content");
oButton.placeAt("content");

Controller click function -


sap.ui.getCore().byId("tv").setText("Set in Controller");

When I use this.byId() and view.byId() this works but not on the sap.ui.getCore().byId(). Is there anything that I am doing incorrectly here?

 

Thanks,

Nagarajan.


Viewing all articles
Browse latest Browse all 6178

Trending Articles



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