2024 Mar 12 2:15 PM - edited 2024 Mar 13 6:53 AM
Hi all,
Trying to attach a function to the method attachPropertyChange on the sap.ui.model.odata.v4.ODataModel
onAfterRendering: function () {
var oModel = this.getView().getModel(); //based on sap.ui.model.odata.v4.ODataModel
oModel.attachPropertyChange(() => console.log("hello"));
}
in the console it appears:
Has the event `PropertyChange` been deprecated on `sap.ui.model.odata.v4.ODataModel`?
Has the event `PropertyChange` been deprecated on `sap.ui.model.odata.v4.ODataModel`?
The model is defined in `manifest.json` file and it has the version 4.0
"dataSources": {
"mainService": {
"uri": "/sap/opu/odata4/sap/ui_sensitivefielditem/srvd/sap/ui_sensitivefielditem/0001/",
"type": "OData",
"settings": {
"annotations": [
"annotation"
],
"localUri": "localService/metadata.xml",
"odataVersion": "4.0"
}
},
"annotation": {
"type": "ODataAnnotation",
"uri": "annotations/annotation.xml",
"settings": {
"localUri": "annotations/annotation.xml"
}
}
}
},
"models": {
"i18n": {
"type": "sap.ui.model.resource.ResourceModel",
"settings": {
"bundleName": "com.swisslife.vimsensitivefielditem.i18n.i18n"
}
},
"": {
"dataSource": "mainService",
"preload": true,
"settings": {
"synchronizationMode": "None",
"operationMode": "Server",
"autoExpandSelect": true,
"earlyRequests": true
}
},
Best regards
2024 Mar 13 3:16 PM - edited 2024 Mar 13 3:17 PM
Is this Question the same as "odata - Error: Unsupported event 'propertyChange': v4.ODataModel#attachEvent - Stack Overflow"? Suggestion that is offered is to verify your SAPUI-version : API Reference - Demo Kit - SAPUI5 SDK (ondemand.com) as the 'PropertyChange' is only available from "SAPUI5 1.110.0" ...
(Full disclosure : I do not claim to have the export knowledge regarding the solution, it was provided elsewhere by another person.)