I am new to SAPUI5 and want to update an entity data using oListData. I am not able to find any tutorial that explicitly explains this.
My onSave
function looks like this:
onSave: function() {
var oDialogContext;
var oNewItem = {
};
var oForm = this.byId("companyObjectEditForm");
var description = this.getView().byId("description").getValue();
var validation = this.getView().byId("invalidCombo").getValue();
oNewItem.Beschreibung = description;
const compareValue1 = validation.localeCompare("Ungueltig")
if(validation === "Ungültig"){
oNewItem.Ungueltig = 1;
}
else{
oNewItem.Ungueltig = 0;
}
var oView = this.getView();
function resetBusy() {
oView.setBusy(false);
}
oView.setBusy(true);
// oListBinding.create(oNewItem);
this.getView().getModel().submitBatch("cmpchange").then(resetBusy, resetBusy);
this.onNavBack();
},
I am setting the binding using the following code:
var path = this.getAppModel().getProperty("/selectionPath");
//oListBinding = this.getView().getModel().bindList({path,parameters: {
"$$updateGroupId": 'cmpchange' }});
My path is like this Company(id) -> which depicts the record to be updated. The oListBinding.create(oNewItem) works completely fine and creates a new entity however there is no function explicitly mentioned for updating.I have mostly seen updates done relevant to binding. Can anyone review the code and point out if the binding is correct or not.