cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Accepted Solutions (1)

Accepted Solutions (1)

former_member182862
Active Contributor

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

Answers (2)

Answers (2)

junwu
Active Contributor

your title and content really don't match

what's your problem?

0 Kudos

i have three views. i want to use first view "contol id" in second view contoller.

junwu
Active Contributor

don't access the ui control in your controller(unless you have no choice)

if you really want.... use event to inform the first view controller to do the job

Former Member
0 Kudos

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

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

bpawanchand
Active Contributor
0 Kudos

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