【问题标题】:How to refresh(reload) SAPUI5 oModel (oData)如何刷新(重新加载)SAPUI5 oModel(oData)
【发布时间】:2014-10-24 10:36:49
【问题描述】:

我有以下问题。我能够正确调用函数 UserDelete 来删除 SAP 端表中包含用户数据的行,但删除的对象仍在 oModel 中。如何刷新或销毁并重新创建 oModel ?我尝试使用:

oModel.destroy();
var oModel = new sap.ui.model.odata.ODataModel("http://plaut0001.plaut.pl:8000/sap/opu/odata/sap/ZUSERINFO_SRV/",true,"developer","gliwice");   
sap.ui.getCore().setModel(oModel);

但在此之后我收到以下错误: 未捕获的类型错误:无法读取未定义的属性“dataServices”

下面是我在 SAP 端调用函数删除用户的代码:

//handle delete button
handleDelete : function(evt) {
    var context = evt.getSource().getBindingContext();
    var oModel = sap.ui.getCore().getModel();
    oModel.callFunction('UserDelete', 'POST', 
            {Userid : context.getProperty("Userid")}, 
            null, 
            function(){sap.m.MessageBox.show("Pomyślnie usunięto");}, 
            function(){sap.m.MessageBox.show("Błąd");}
        );


    sap.ui.getCore().getEventBus().publish("nav", "to", {
        viewId : "app.details.Empty",
        data : "" 
    });

【问题讨论】:

  • 你试过oModel.refresh(true,true); ?
  • 是的。没有任何改变。

标签: javascript html sapui5


【解决方案1】:

您必须在代码中的删除命令之后绑定服务。请提供您已经尝试过的示例 Jsbin 链接。

【讨论】:

  • 对不起,我是 javascript 的新手。可以给一些提示如何做到这一点?
猜你喜欢
  • 1970-01-01
  • 2018-06-04
  • 2013-03-29
  • 1970-01-01
  • 1970-01-01
  • 2017-04-12
  • 1970-01-01
  • 2010-12-03
  • 1970-01-01
相关资源
最近更新 更多