Skip to Content
avatar image
Former Member

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

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);
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Aug 23, 2017 at 10:20 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 23, 2017 at 10:39 AM

    The parameter "dataSource" names should be the same.

    Add comment
    10|10000 characters needed characters exceeded