Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change data in OData v4 model programmatically?

Former Member
0 Kudos

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?

  • SAP Managed Tags:
0 REPLIES 0