Hello,
I'm not expert on SAPUI5 but I already build Fiori Applications starting with the generated apps from SAP Webide. Maybe this is the reason I missed something, but this time I used the last version of FIORI template and it doesn't work as I expect.
Model is define in manifest.json :
"models": { "i18n": { "type": "sap.ui.model.resource.ResourceModel", "settings": { "bundleName": "customerexpiredprices.i18n.i18n" } }, "": { "dataSource": "mainService", "preload": true, "settings": { "defaultBindingMode": "TwoWay", "useBatch": true, "defaultCountMode": "Inline" } } },
I want to delete multiple lines of an entity, but I want to do it in one request, this is why I used submitChanges to call the batch request and handle the succes or error event from the submitChanges :
onDeletePress: function(oEvent) { var self = this; //Get Model var oModel = this.getView().getModel(); //get selected lines var oSelectedContextPaths = this.byId("idMaterialList").getSelectedContextPaths(); //Call delete for every lines if (oSelectedContextPaths.length === 0) { MessageBox.error(this.getResourceBundle().getText("noSelection")); } else { oSelectedContextPaths.forEach(function(sPath) { this.remove(sPath); }, oModel); } this.getModel("detailView").setProperty("/busy", true); oModel.submitChanges({ success: function(oData, sResponse) { MessageToast.show(self.getResourceBundle().getText("deleteConditionSuccess")); self.getView().getModel().refresh(true); self.getModel("detailView").setProperty("/busy", false); }, error: function(oError) { self.getModel("detailView").setProperty("/busy", false); } }); },
Neither Success nor error functions defined in submitChanges method are called. Althought if I attach success function in the remove method it is called but for every lines.
I didn't expected this behavior, and i'm pretty sure I did something similar before and the succes was called from the submitChanges.
Please help...