cancel
Showing results for 
Search instead for 
Did you mean: 

Pass oData between one controller to another

Former Member
0 Kudos

Hi Experts,

I'm developing an app in SAPUI5 where the data come the gateway service from SAP.

I receive the data and make the necessary handling and this is then loaded into the table. But I need send this data for other controller. How can I do this in JavaScript ? I have this table, when I click in the row this pass to another view.


Way I received my oData.


But in the second view I need the same data that in first view. I use this.getRouter().navTo("page2"); for navigate to another view.

This is my first view

And this is second view

Please I need your help because I'm charging twice the same data.

Best Regards
Cristina Rodrigues

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Do you have a reason to set your model to the core? This will be critical if you run several apps with the same runtime (as in FLP or other containers)

I would recommend to set it to the component, means you should either move the coding above to you component or call


this.getOwnerComponent().setModel(yourModel, "modelname")

This will make the model accessible to all your views by the name.

Actually if you set the model to the core as you do it should already be available to all your views.

Please test.

If you need to do additional modification you can call


sap.ui.getCore().getModel("modelName")

//or if set on the component

this.getOwnerComponent().getModel("modelName")

//or for all cases

this.getModel("modelName")

Former Member
0 Kudos

Thanks for your help. I had already tried this way but somehow did not give. I should have put some things wrong. Best Regards

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

you don't have the data if you don't call again in second view?

Former Member
0 Kudos

I have the data in first controller and I need pass this same data from second controller. 
Because I need to do another manipulation for inserting data in the second table.

Thanks for your time

junwu
Active Contributor
0 Kudos

are u answering my question?

Former Member
0 Kudos

yes, I am

junwu
Active Contributor
0 Kudos

i don't see it....

Former Member
0 Kudos

I have the data in first controller and I need pass this same data from second controller.  Because I need to do another manipulation for inserting data in the second table. Thanks for your time

junwu
Active Contributor
0 Kudos

Do I ask this? are u reading my question?

0 Kudos

come on guys. let`s concentrate on essential things.

junwu
Active Contributor
0 Kudos

i think it is.

if you set it into core, I think it is available everywhere....although I never store in core

that's why I asked that question. he doesn't have to call again. but he is not reading....