Pass Static Value to Formatter Parameters in XML View

前端 未结 6 1797
清酒与你
清酒与你 2020-12-18 09:49

I want to call the function getCountdown with two parameters:

  • The first (AuctionEnd) is dynamic from a model.
  • The second should be hard
6条回答
  •  旧巷少年郎
    2020-12-18 10:39

    Solution for version < 1.61:

    1. Register a model to view in init method

      onInit: function() { // JSONModel required from "sap/ui/model/json/JSONModel"
        var oModelConstants = new JSONModel(Object.freeze({ myConstant: 123 }));
        oModelConstants.setDefaultBindingMode("OneTime");
        this.getView().setModel(oModelConstants, "constants");
      }
      
    2. In XML view, assign your formatter with the following parts:

      
      

    For version 1.61 and above, see answer 53609552.

提交回复
热议问题