Hi,
I have a following problem. I am able to properly call function UserDelete to delete a row with user data in table on SAP side but deleted object is still in oModel. How to refresh or destroy and recreate oModel ? I tried to use :
oModel.destroy();
var oModel =new sap.ui.model.odata.ODataModel("<url>/sap/opu/odata/sap/ZUSERINFO_SRV/",true,"developer","gliwice");
sap.ui.getCore().setModel(oModel);
but after this i got following error: Uncaught TypeError: Cannot read property 'dataServices' of undefined
Below is the code I use to call function deleting user on SAP side:
//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 :""
});