[sapui5] [model] Set Operation of Odata model to client side

Hello,

You can use the operation mode parameter for the v2.ODataModel. This parameter can be set at the model level (see the constructordefaultOperationMode parameter) or at binding level (see the constructoroperationMode parameter).
Based on this parameter, the model fetches data differently:
  • Server mode: data is fetched as needed (paging, sorting and filtering is done on the server side; each sorting, filtering or paging operation triggers a request).
  • Client mode: the whole collection is requested initially. All sorting, filtering and paging operations are done on the client.
  • Auto: a combination (based on other model settings).
To read more about the operation mode, check out the corresponding documentation: OperationMode.
If you want to use this only on one list, then you should you the binding variant:
<List items="{path: '/Collection', parameters: {operationMode: 'Client'}}">
    <StandardListItem title="{Field}" />
</List>

If you want to set all of your OData Model into Client Operation mode, change the setting in the manifest.json:


Or when you create the new model:

var oModel = models.createODataModel({
urlParametersForEveryRequest: [
"sap-server",
"sap-client",
"sap-language"
],
url: this.getMetadata().getConfig().serviceUrl,
config: {
metadataUrlParams: {
"sap-documentation": "heading"
},
defaultOperationMode: sap.ui.model.odata.OperationMode.Client
}

---V---

Nhận xét

Bài đăng phổ biến từ blog này

Tại sao lại chụp ảnh theo bố cục 1/3 ?

[sapui5] Best Practice in sapui5 development

Implement Search field with case-INSENSITIVE by SAP UI5