Merge 2 arraycollection - Flex 3

How do I actually merge both together?

one arraycollection will contain the value 0 ... 30 with the object name "sxx" with another extracting the arraycollection from the database.

+4
source share
2 answers

Hi!

Solution 1:

private function mergeArrays(a:ArrayCollection, b:ArrayCollection):ArrayCollection { for each(var item:Object in b) { a.addItem(item); } return a; } 

Solution 2:

 var a:ArrayCollection = new ArrayCollection([1,2]); var b:ArrayCollection = new ArrayCollection([3,4]); a = new ArrayCollection(a.toArray().concat(b.toArray())); 

Good luck : P

+5
source
 var first:ArrayCollection = new ArrayCollection(['aa','aaa','aaaa']); var second:ArrayCollection = new ArrayCollection(['bb','bb','bb']); first.source = first.source.concat(second.source); 
0
source

Source: https://habr.com/ru/post/1305974/


All Articles