【发布时间】: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