on 2022 Dec 08 10:47 AM
Hi Team,
I am facing an issue in my custom UI5 application while reading the data from backend for my Read query -
onInit: function () {
this.oModel = this.getOwnerComponent().getModel();
this.oCustTable = this.getView().byId("idCustTable");
this.oModel.read("/ET_Deal_CustListSet", {
success: function (odata) {
var CustJsonData = new JSONModel(odata.results);
this.getView().setModel(CustJsonData, "ET_CustList");
}
});
},
manifest1.jpgmanifest2.jpgmanifest3.jpgmanifest4.jpg
Please advise.
Regards -
Meenakshi
Your screenshot "manifest3.jpg" shows the issue: the default model (model declaration with the empty string "" as its name) is not within the /sap.ui5/models section of manifest.json.
Solution: move the default model declaration, same as the "i18n" model declaration, to the section /sap.ui5/models.
___
Please consider developing / maintaining UI5 application projects either within SAP BAS or VSCode with the extension UI5 Language Assistant. That extension would've notified you about the misplaced section.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please include your default odata model in the model section in manifest.json file
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi meenakshi.raina,
please debug your code and check the position raising the error.
Perhaps you see the error line in the JavaScript console?
It could be the case that the success methode doesn't have access to this.getView().
In this case you can change your code to:
or
success: function (odata) {
var CustJsonData = new JSONModel(odata.results);
this.getView().setModel(CustJsonData, "ET_CustList");
}.bind(this)
});
var that = this;
....
success: function (odata) {
var CustJsonData = new JSONModel(odata.results);
that.getView().setModel(CustJsonData, "ET_CustList");
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
did you included the section "models" to the manifest file?
"models": {
"": {
"dataSource": "mainService",
"settings": {
"defaultBindingMode": "TwoWay",
"defaultCountMode": "Inline",
"refreshAfterChange": false
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi meenakshi.raina,
This could be because this.getOwnerComponent().getModel() is returning undefined. Kindly check if it helps 🙂
Thanks and Regards
Ashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ashish
Yes, that's correct. But I have defined my service in the manifest file. img-20221208-wa0032.jpg
Do I need to do more?
User | Count |
---|---|
70 | |
10 | |
8 | |
8 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.