Skip to Content
0
Oct 15, 2019 at 03:57 AM

Refreshing model after Odata.remove not working

685 Views

Once I delete a record, I am trying to refresh my model so the table to which the model is bound shows latest set of records...which is not working though. May I know how we can refresh the model after delete method is invoked. Or, the only way to show latest records (post deletion) in the table is to again call a READ method and get the records from the back-end ?

var oTab = sap.ui.core.Fragment.byId("DOCSUPLOAD", "idTab").getModel("docsList");

var oDataMdl = this.getOwnerComponent().getModel();

oDataMdl.remove("/<EntitySet>(keycolumn='Value_1', keycolumn2='key2')", 
{ 

success: function(oData, oResponse){

sap.ui.core.Fragment.byId("DOCSUPLOAD", "idTab").getModel("docsList").refresh();

MessageBox.show("Success");

}.bind(this),

error: function(oError){
	MessageBox.show("Failed");
}					
}