Show TOC

Setting the Default Binding ModeLocate this document in the navigation structure

When a model instance is created, the instance has a default binding mode. You can overwrite this default setting.

Procedure

  1. To change the default binding mode directly after model creation, call the setDefaultBindingMode method on the model as follows:
    var oModel = new sap.ui.model.json.JSONModel();
    oModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneWay);

    In this example, all new bindings for the model will have the one-way binding mode by default.

  2. You can, however, only set supported binding modes as default binding mode. You can check if a binding mode is supported as follows:
    var oModel = new sap.ui.model.json.JSONModel();
    if (oModel.isBindingModeSupported(sap.ui.model.BindingMode.OneTime)) { // true
        oModel.setDefaultBindingMode(sap.ui.model.BindingMode.OneTime); 
    }