=
generrally we use two kind of Models
JsonModel we will uset the Jsonmodel in order to Decrese the Operation in the Backend
Odata We will use the Odata in order to Do The CRUD operation in The DB
It is very much recommended to use the Json Model for the Local Operation and then we will Create Entities to Send Out With The Odata Model
One of the Great problem we introduce Is that we want to send out only the relevant entities
so we need to keep a copy of the original data so we can compare with the Entities that were changed to so we will write the following: this.oldData = JSON.parse(JSON.stringify(oData))
when We want to Update One Entity we will use do For Example oModel.update(“/Products(999)”, oData, {success: mySuccessHandler, error: myErrorHandler})
for Updating Several Items We will Do The Following for Example:
this.Odata.update(path, Entity[i], {groupId: "batchFunctionImport", changeSetId: path, async: false }) this.Odata.submitChanges({ groupId: "batchFunctionImport", success: function (oData) { MessageBox.success(oResourceBundle.getText("saveSaleItemSuccess"), { title: oResourceBundle.getText("success"), styleClass: bCompact ? "sapUiSizeCompact" : "" }); // controller._oEditDialog.setBusy(false); // controller._oEditDialog.close(); }, error: function (oError) { MessageBox.error(oResourceBundle.getText("saveSaleItemError"), { styleClass: bCompact ? "sapUiSizeCompact" : "" })