Skip to Content

"Uncaught TypeError: s is not a function datajs.js:17" after ODataModel update method in SAPUI5

Hello,

I am having an issue with the update method of my ODataModel, I am trying to update property "Werks

" of AgentsSet entity. The update request returns 204, and the data is updated indeed, but right after it takes about 60s and then triggers an error as follows:

The count request works fine when I paste it separately as URL in the browser

Here is my code of the update method which happens after clicking the "save" button:

onSave: function (oEvent) {
	var aModel = this.getView().getModel();
	var aItem = this.getView().byId("list").getSelectedItem();
	var aEntry = {};
	aEntry.Werks = sap.ui.getCore().byId("editDiv").getValue();
        
        if (aEntry.Werks === "") {
		jQuery.sap.require("sap.m.MessageBox");
		sap.m.MessageBox.alert("Champs vides!");
	} else {
		aModel.read("/DivisionsSet('" + aEntry.Werks + "')", {
			success: function () {
				aModel.update("/AgentsSet('" + aItem.getBindingContext().getProperty().MatAgent + "')", aEntry, false, {
					success: function () {
						this._editDialog.close();
					}.bind(this),
					error: function () {
						jQuery.sap.require("sap.m.MessageBox");
						sap.m.MessageBox.alert("Erreur inattendue!");
					}
				});
			}.bind(this),
			error: function () {
				jQuery.sap.require("sap.m.MessageBox");
				sap.m.MessageBox.alert("Division inexistante!");
			}
		});
	}
},

I have tried to use setProperty() with submitChanges() instead of update() but it behaves the same way

aModel.setProperty("/AgentsSet('" + aItem.getBindingContext().getProperty().MatAgent + "')/Werks", aEntry.Werks);
aModel.submitChanges();
this._editDialog.close();

Any ideas how to solve this problem?

Thank you in advance,

capture.jpg (194.2 kB)
capture.jpg (49.5 kB)
capture.jpg (48.8 kB)
capture.jpg (52.7 kB)
capture.jpg (43.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers