Anshad Vattapoyil
Anshad Vattapoyil

Reputation: 23463

Access one controller inside another in SAPUI5

I have a SAPUI5 master detail page application. So in master page controller I need to access an element which is defined in detail view. How can I do it?

jQuery.sap.require("util.Formatter");
jQuery.sap.require("util.Networkaccess");

sap.ui.controller("view.Sales.SalesOrder.SoMaster", {
    myFunc: function() {
        var iconTabBar = this.byId('itabBar'); 
        iconTabBar.setSelectedItem(iconTabBar.getItems()[1]);
    }
})

The above code will through error because the itabBar element is not there in master view, it's defined in detail view file.

Upvotes: 2

Views: 9616

Answers (1)

Jasper_07
Jasper_07

Reputation: 2473

i am not sure i exactly know what you are trying to do, controls have unique id's prefixed by the view, you could try

var iconTabBar = sap.ui.getCore().byId("vwDetails--itabBar")

Upvotes: 4

Related Questions