Skip to Content
avatar image
Former Member

How can I change data in OData v4 model programmatically?

I have a named OData version 4 source in my SAPUI5 application. I need to manipulate object data in a button click event handler like this:

var oContext = evt.getSource().getBindingContext("dsName"); // works

var sPath = oContext.getPath() + "/myPropertyName";

// Approach 1 for setting value to true:

oContext.getModel().setProperty(sPath, true); // not working

// Approach 2:

var item = evt.getSource().getBindingContext("dsName").getObject();

item.myProperty = true; // not working

The only way I managed to change the property value was by two-way-binding it to a control (check input). Can someone tell me if and how it is possible to update OData v4 models in code?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers