Reputation: 199
I have a sap.ui.Table with 10 records. If I perform any operation on that sap.ui.Table like Submit by selecting a particular row, operation should perform and Row should get removed from the table. Row data is getting submitted but row is not getting removed from the table. I tried by refreshing the table. But didn't worked for me. Below is the piece of code.
this.oDataModel.create("/testService", dataToSend, {
success: function(data, resp) {
var oXML = jQuery.parseXML(resp.headers["sap-message"]);
var oXMLMsg = oXML.querySelector("message");
var response = oXMLMsg.textContent;
MessageBox.success(response);
var listBinding = this.getView().byId("idLeaveTable");
var leaveModel = listBinding.getModel("approvalModel");
leaveModel.refresh(true);
that.successApprovalModel();
},
error: function(err) {
var oXML = jQuery.parseXML(err.response.body);
var oXMLMsg = oXML.querySelector("message");
MessageBox.error(oXMLMsg.textContent);
}
});
Here if iam submitting any row to backend service then corresponding row should get removed from both table and model. As of now it is not happening. But if im reloading the application then the corresponding row is getting removed.
Can some one please help me to resolve the issue.
Thank you in advance
Upvotes: 1
Views: 22874
Reputation: 221
For the oData model you should use the method 'remove' to trigger a DELETE request to the oData service. The 'create' method triggers a POST request.
Upvotes: 0
Reputation: 153
Can you try this:
this.byId("lineItemsList").getBinding("items").refresh();
Upvotes: 1