Skip to Content

How to access a control of another view from different controller?

Hi,

I created a master detail application using template in sap webide(local).Using xml views.I need to access List in the master page from detail controller.

I tried sap.ui.getCore().getControl("list") method but it returns undefined.

this.getView().byId("list") is successful from master controller.I tried different methods like byId, getElement etc but was unsuccessful.

What i need is to refresh the detail page after approving the item.Master list is refreshing.for this i need access master list control from detail controller.Plz help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Oct 19, 2015 at 08:13 AM

    Hi Rajeesh,

    Since you're using XML views, the id of the view in run-time will be prefixed with the id of parent control.

    Now consider your master view id is 'master' then you can try like below in your detail controller.


    sap.ui.getCore().byId("master--list");
    
    

    Check this sample: Plunker

    On select of the button placed in Detail will get you the selection mode of list present in Master.

    Regards,

    Sai Vellanki.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.