Skip to Content
avatar image
Former Member

Adding elements to arrays in OData model in SAPUI5


I have a question concernig the adding of an element to an array within an OData Model in SAPUI5.

Is there any standard functionality to add an element where only the necessary attributes of the element have to specified? Or do I have to rebuild the whole object with its structure (like the PositionSet structure in the attached screenshot) and use the push() method to append the new element?

Thanks a lot for any response! :-)



Test.jpg (166.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jan 31, 2014 at 01:02 PM


    I have been looking for a solution as well, because I have the same problem. Namely, when I add an item to a JSON model using myModel.oData.myArray.push(item), a view doesn't refresh itself (a table hasn't an added item, nevertheless it exists within the model). Only when I use myModel.refresh(true) function at the end of adding items, view refresh itself.

    Does anybody have a solution for this issue?

    Best regards,

    Tomasz Sobkowiak

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Tomasz,

      I believe yours is the cleanest solution, you add an element into array and then you refresh the model so that the bindings are refreshed, what more you want 😊



  • Aug 08, 2013 at 06:32 AM

    Hi Flo ,

    I have the same problem :-)


    Add comment
    10|10000 characters needed characters exceeded