Search code examples
odatasapui5

How to pas parameters to model in sapui5


I've configured my destination in menifest.js and now I can access my model in controller. Menifestjs file is as

    "dataSources": {
        "dlContent": {
            "uri": "/destinations/dles/DL/services/DL_CONTENT.xsodata",
            "type": "OData",
            "settings": {
                "odataVersion": "2.0"
            }
        }
    },

and model

    "dlScore": {
            "dataSource": "dlContent"
        }

I want to set parameters like filter, and others. I'm accessing my model as

var mod = this.getView().getModel("dlesScore")

this give me link till my /destinations/dl/DL/services/MY_CONTENT.xsodata/ I want to access /destinations/dl/DL/services/MY_CONTENT.xsodata/DLES_CONTENT?$top=1 how i can add /DLES_CONTENT?$top=1 in my model to get data.


Solution

  • you can direclty set your model after setting menifestjs file.

    <List items="{
      path: 'dlesScore>/DLES_CONTENT'
    }">
      <ObjectListItem title="{dlesScore>id}" />
    </List>
    

    Load OData Service using expand, filter, and sorter