cancel
Showing results for 
Search instead for 
Did you mean: 

getCore().byId() not working

shashidhar_peddi
Explorer
0 Kudos

Hi Experts,

What is the difference between this.getView().byId("id123") and sap.ui.getCore().byId("id123")?

Please see the following JS bin:

http://jsbin.com/facokikilo/edit?html,output

I am trying to get the reference of the two buttons and set their button type dynamically, but the getCore().byId() method is failing to return the reference of the buttons.

Could you check and let me know how to resolve this issue.

Regards,

Shashidhar

View Entire Topic
former_member182372
Active Contributor
0 Kudos

code worth 1000s words:

View.prototype.byId = function(sId) {

  return sap.ui.getCore().byId(this.createId(sId));

};

View.prototype.createId = function(sId) {

  if (!this.isPrefixedId(sId)) {

  sId = this.getId() + "--" + sId;

  }

  return sId;

};

shashidhar_peddi
Explorer
0 Kudos

Hi Maksim,

Where can I find this code? How did you locate it?

Regards,

Shashi

former_member182372
Active Contributor
0 Kudos

resources\sap\ui\core\mvc\View-dbg.js

i just knew it is there, learned years ago LOL