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
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
Share Improve this question edited Apr 27, 2018 at 5:17 user2644620 asked Apr 26, 2018 at 11:06 user2644620user2644620 1992 gold badges13 silver badges39 bronze badges 02 Answers
Reset to default 1Can you try this:
this.byId("lineItemsList").getBinding("items").refresh();
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.