How to prevent OData service call on model change

≡放荡痞女 提交于 2019-12-02 10:30:51

Your approach won't work with a ODataModel as it is strictly server side. Please use the corresponding remove method to delete an entity from the server.

Since Odata is server side model, it always triggered a round trip. So I did not bind my sap.m.Table to Data model. Instead I triggered a read manually. On success I copied the data received to local JSON model. I bound my table items to this JSON model. Now the delete button works just fine.

// Define a JSON Model
oJsonModel = new sap.ui.model.json.JSONModel();

//oModel is Odata model defined in manifest file
oModel.read("/entity1", {
    success: function(oData, oResponse){
        oJsonModel.setProperty("/entity1", oData.results);

        // bind oJsonModel to table here
    }    
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!