Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9052

Re: JSONModel merge not working?

$
0
0

If you want to merge arrays, you should use jQuery.merge().

 

$.merge( [ 0, 1, 2 ], [ 2, 3, 4 ] );

//result is [ 0, 1, 2, 2, 3, 4 ]

 

 

You could do it:

var oldArray = [ obj1, obj2, obj3, obj4 ];

var newArray = [ obj5 ];

oModel.setData(   $.merge( oldArray, newArray )   );

 

 

But, if you want just to add one item at the end of the array, you also could do it:

oModel.getData().push( obj5 );


Viewing all articles
Browse latest Browse all 9052

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>