user49126
user49126

Reputation: 1863

Ext,apply and arrays

I'd like to merge two items arrays into one. I use for this the Exp.apply method. But the result contains only items from the second array.

Sample

http://jsfiddle.net/L3HHY/

The expected result should be

{ items:[{ name:'xxx' }, { name2:'yyy'}]})

Upvotes: 1

Views: 5496

Answers (1)

CD..
CD..

Reputation: 74166

You can use array.push() function:

var items = [{name: 'a'}];

items.push({name: 'b'}); //  items = [{name: 'a'}, {name: 'b'}]

Or Ext.Array.merge():

items = Ext.Array.merge([{name: 'a'}], [{name: 'b'}]) 

Upvotes: 6

Related Questions