on 01-16-2021 6:22 PM
Dear Team,
I am following tutorial using business application studio and facing this below error. i tried to search the forum. got few threads however did not help me to resolve the issue.
no matter which method i tried, i keep getting syntax error saying 'getResourceBundle' is not part of model. I am sending "sap/ui/model/resource/ResourceModel" module. then i am setting the resourcemodel like below.
var rmodel = new ResourceModel( {
bundleName : "My.Learning.webmodule.i18n.i18n" } );
this.getView().setModel(rmodel,"i18n");
after that i am trying to read the resource bundle with below syntax.
var oBundle = this.getView().getModel("i18n").getResourceBundle();
after getModel("i18n"), after pressing dot, even context help is not showing the getResourceBundle method. Below is the full source code.
am I missing something ? Please help.
sap.ui.define([ "sap/ui/core/mvc/Controller", "sap/ui/model/resource/ResourceModel" ], /** * @param{typeof sap.ui.core.mvc.Controller}Controller */ function (Controller,ResourceModel) { "use strict";just want to add one more question.
when i looked at syntax
this.getView().getModel() , getModel() will return sap.ui.model.Model. when i checked this class documentation does not hold getResourceBundle method. So how it is working for you. Please help. i am newbie here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Praveen,
sap.ui.model.Model is the parent class, but while returning it will cast your return object based on the model type. If it oDataModel it will return oDataModel object and henceforth. In this case, the object returned is of sap.ui.model.resource.ResourceModel which has this method.
Thanks
Prashil
User | Count |
---|---|
77 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.