Skip to content

Latest commit

 

History

History
22 lines (11 loc) · 1.23 KB

custom-model-91f1c7e.md

File metadata and controls

22 lines (11 loc) · 1.23 KB

Custom Model

Custom models can be used if none of the models provided by OpenUI5 is suitable for the specific needs of an application.

Note:

The subclassing of standard models is not supported in OpenUI5.

To instantiate a custom model, proceed as follows:

  1. Extend the Model class and specify the binding modes that the model should support (for example, two-way, one-way, one-time).

  2. Extend the Binding class to suit your specific binding or reuse the existing specific binding implementations PropertyBinding, ListBinding, and/or TreeBinding.

  3. To enable the filtering functionality, use the Filter class with FilterOperator enum in your binding implementation.

  4. To enable the sorting functionality, use the Sorter class in your binding implementation.

You can find all necessary classes in the sap.ui.model namespace. As a starting point, take a look at the JSONModel implementation in sap.ui.model.json.JSONModel, which is available on the SAP Open Source GitHub at https://github.com/SAP/openui5/blob/-/src/sap.ui.core/src/sap/ui/model/json/JSONModel.js.