Skip to Content
0

How to access OData model Defined in Menifestjs file,setting parameters and bind with view.

Aug 23, 2017 at 09:28 AM

21

avatar image
Former Member

I've set my model in menifestjs file as

"dataSources": {
	"dlesContent": {
	"uri": "/destinations/dl/DL/services/DL_CONTENT.xsodata",
	"type": "OData",
	"settings": {
		"odataVersion": "2.0"
		}
	     }
	},
"models": {
	"i18n": {
		"type": "sap.ui.model.resource.ResourceModel",
		"settings": {
			"bundleName": "dlesDLESdashboard.i18n.i18n"
				}
			},
			"dlScore": {
				"dataSource": "dlContent"
			}
		},

I am accessing in my controller as

var oModel = this.getOwnerComponent().getModel("dlScore");

I've a table inside dl_Content how can i access that with parameter and set my model. I'm trying below method but I gives me some error. what is the right method to bind and access model.

oModel.read("/DL_CONTENT", null, ["$filter=ITEM_TYPE eq 'E-Learning'"], null, function(oData, oResponse) {
				console.log(oData);
			}, null);
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Sergio Guerrero Aug 23, 2017 at 10:20 AM
1

what error are you seeing?

Ii explained something similar in this blog https://blogs.sap.com/2016/05/26/using-hcp-to-develop-a-custom-fiori-app/ but the manifest refers to the component and you set up your model in your component. Hope it helps

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Aug 23, 2017 at 10:39 AM
0

The parameter "dataSource" names should be the same.


capture.png (14.5 kB)
Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

yah both are same,, its mistake here.. but originally both are same

0