直接在UI5里使用jQuery, 而不是oData API去绑定模型

sap.ui.controller("sapui5_test.SAPUI5_Test", {

 initTodoModel : function() {  
        var oModel = new sap.ui.model.json.JSONModel();
        var aData = jQuery.ajax({
            type : "GET",
            contentType : "application/json",
            url : "http://sapm04.ibsolution.local:50000/demo.sap.com~d337_resttest_web/rest/todo/init/",
            dataType : "json",
            async: false, 
            success : function(data,textStatus, jqXHR) {
                oModel.setData({modelData : data}); 
                alert("success to post");
            }

        });

        return oModel;  
    }
  }

 });

参考:https://stackoverflow.com/questions/20099783/reading-rest-service-with-sapui5

发布了7283 篇原创文章 · 获赞 664 · 访问量 134万+

猜你喜欢

转载自blog.csdn.net/i042416/article/details/105451302
今日推荐