cancel
Showing results for 
Search instead for 
Did you mean: 

how to get value from master controller to detail view or controller

former_member229036
Participant
0 Kudos

Dear All,

how to pass value of CatID which defined in onSelect funtion in master.controller.js into detail.view.js or detial controller?

i just want to get CatID in detail.view...

please help me.

[master.controller.js]

onInit: function () {

var oData = { "names": [ { CatID: "SD", CatName: "Sales", CatDesc: "Sales etc..." }, ] }

var oModel = new sap.ui.model.json.JSONModel();

oModel.setData(oData);

sap.ui.getCore().byId("idHdr").setModel(oModel);

},

onSelect: function (oEvent) {

// ID

var oContext = oEvent.getParameter("listItem").getBindingContext();

var CatID = oContext.getProperty("CatID");

console.log(CatID) is working good

.

.

}

[Deatil.view.js]

how to get CatID ????

Thank you in advance

David.

Accepted Solutions (0)

Answers (2)

Answers (2)

junwu
Active Contributor
0 Kudos

put the data in model, and save the model at component level, which make the model shared across view controller

vvdries
Contributor
0 Kudos

Hi Benjamin,

Take a look at the following tutorial:

Routing with paramters:

https://help.sap.com/doc/saphelp_uiaddon20/2.05/en-US/23/66345a94f64ec1a80f9d9ce50a59ef/content.htm?...

Kind regards,

Dries