Skip to Content
0
Oct 25, 2021 at 02:19 AM

SAPUI5 Odata Model V4 SubmitBatch does not affect "hasPendingChanges"

1055 Views Last edit Oct 25, 2021 at 02:20 AM 2 rev

Data has been changed in the form and submitBatch has successfully updated the server data. oBinding.hasPendingChanges()
should be false but stays true even though the batch has been successfully submitted.

Why is oBinding.hasPendingChanges() still returning true when it should be false?

groupProperties.Submit can be either API or Auto and the issue persists

Code:

var oBinding = this.byId("idMainTable").getBinding("items");
var oThis = this;

var fnSuccess = function() {
oBinding = this.byId("idMainTable").getBinding("items");
var bChangedAfter = oBinding.hasPendingChanges()
//bChangedAfter should be = false but is still true!! Why?
//The data has been updated correctly at the server.

}.bind(oThis);

var fnError = function(oError) {
//handle error
MessageBox.alert(oError.message);

}.bind(oThis);


if (oBinding.hasPendingChanges()) {
oThis.getView().getModel().submitBatch("ladderList").then(fnSuccess, fnError);

} else {
//Do nothing - no changes to Submit

}