avatar image
Former Member

SAP UI5 oDataModel setProperty not working


I am not able to set the value of a field in the oData model using setProperty, I am getting "false" as return value.

I have used a "CRUD Master-Detail Application" . From the Detail view, I navigate to Edit view. I have Input fields and a radio button on the Edit page. If I change the value of the Input field, the model is getting updated. For the radio button, I have a function for "select" property defined for RadioButtonGroup. I am getting the value(based on the selectedIndex) but when I am using setProperty on the oData Model, I am getting a false as a return.

In the controller for the Edit view, in "OnInit" function, I have a call for "_onEdit" function. I am using to bind the data to the view.

oPath = "/ItemsEntitySet(Index)" (Index selected on the Detail View)


path: oPath


On Radio button selection, I am getting the selectedIndex and the value corresponding to the index and trying to set the value back to the oData Model(200 is the value to be set for the field in oData Model Items Entity. And oResult is "false".

var oResult = this.getModel().setProperty("/ItemsEntityDetail/Index/Field", "200");

Please let me know what I am missing. Other Input fields on the Edit view are automatically getting updated when their values are changed.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jun 02, 2017 at 01:48 PM

    how about this?


    this.getModel().setProperty(path+"/Field", "200");

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 02, 2017 at 02:03 PM

    Hi Jun,

    Thank you for the quick reply. I tried with your suggestion and it still didn't work.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I see it now. I changed it "if (index == 1)" and it works now. Thank you for pointing it out and suggestions on the var oPath1 ="/BankDetailSet('"+index+"')";

Skip to Content