cancel
Showing results for 
Search instead for 
Did you mean: 

Id is not defined

0 Kudos

Hello UI5 experts,

I have the ReferenceError that id ("Component1") is not defined.

But I thought I already define the id of the item.

items: [new sap.m.TabContainerItem("Component1", {

var Tab_xx = new sap.m.TabContainer("TabContainer", {
busy: true,
busyIndicatorDelay: 2000,
visible: true,
items: [new sap.m.TabContainerItem("Component1", { error occurred on this line
name: "All",
key: "All",
modified: false,
}), new sap.m.TabContainerItem("Component2", {
name: "Scube",
key: "Scube",
modified: false,
}), new sap.m.TabContainerItem("Component3", {
name: "Non Scubes",
key: "Non Scubes",
modified: false,
})],
itemSelect: function(oControlEvent) {
var sId = oControlEvent.getSource().getId();
if(sId === Component1) {
alert("Hello");
} else if (sId === Component2) {
alert("Goodbye");
}
}
});

Do you have any idea why it happened?

Best regards,

Nikita

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor

you didn't mention which line throws error.

i guess you need to use sap.ui.getCore().byId("ComponentScube1") to get reference to that control.