Skip to Content

how to Access one view controller instance to another view in same sap ui5 application?

i am begginer to sap ui5.

i tried so many ways. like sap.ui.getCore().byId("control id"); and this.getView().byId("control id"); like that but i am getting error as undefined.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Jul 11, 2017 at 06:34 AM

    Hi Chandeep

    you can do this

    var oView = sap.ui.getCore().byId('<view Id>'); // this gives you the view
    var oController = oView.getController();

    I do not know what you intend to do with this. I do not suggest that you try to call function of the controller directly.

    Thanks

    -D

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 10, 2017 at 05:04 AM

    your title and content really don't match

    what's your problem?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      use sap.ui.getCore().byId('splitAppId').getPages()[0].getController()

      here splitAppId is your SplitApp id Which is defined in Component.js file

  • Jul 10, 2017 at 10:20 AM

    Hi,

    I guess you are trying to access data of a view from other view. If this is the case then probably I would suggest to make use of the MODELs to access data .

    Thanks,Pavan

    Add comment
    10|10000 characters needed characters exceeded