Skip to Content
0
Former Member
Jul 25, 2016 at 11:38 AM

Changing default model data

120 Views

Hey,

in my Fiori App my model is instantiated with automatic model instantiation SAPUI5 SDK - Demo Kit

Now I want to access the parameter of the default model in my Component. I have found a way to access the i18n model of my App, but I dont know how to access the default model, because it has no name.

Here is a little code snippet where I read my i18n.

var oModels = this.getMetadata().getModels(); var sNamespace = this.getMetadata().getManifestEntry("sap.app").id; var oi18nModel = new JSONModel(jQuery.sap.getObject(sNamespace, oModels.i18n)); this.setModel(oi18nModel, ""); var oModelsNew = this.getMetadata().getModels();

console.log("Ausgabe: " + JSON.stringify(oModelsNew.i18n));

In line 3 I can access the model with oModels.i18n, but how to get the default model?

Thanks for your help,

Best regards,

David