Skip to Content
0

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

Jul 10, 2017 at 05:00 AM

164

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

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

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

Share
10 |10000 characters needed characters left characters exceeded
Jun Wu Jul 10, 2017 at 05:04 AM
1

your title and content really don't match

what's your problem?

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

0

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

1
Former Member

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

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

0
Pavan Bhamidipati Jul 10, 2017 at 10:20 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded