admin管理员组

文章数量:1291120

i`ve an object collection. The problem is that add the object collection to another collection in Backbone.Push and add methods of Bacbone.Collection don't work.here is my collection which is need to be added to another collection

i`ve an object collection. The problem is that add the object collection to another collection in Backbone.Push and add methods of Bacbone.Collection don't work.here is my collection which is need to be added to another collection

Share Improve this question edited Apr 4, 2013 at 5:16 nAkhmedov asked Apr 4, 2013 at 5:06 nAkhmedovnAkhmedov 3,5925 gold badges40 silver badges74 bronze badges 2
  • stackoverflow./questions/10388199/… – Paul Hoenecke Commented Apr 4, 2013 at 5:15
  • i need to join two collection to each other – nAkhmedov Commented Apr 4, 2013 at 5:21
Add a ment  | 

1 Answer 1

Reset to default 11

Assuming they are backbone collections (which they don't look like in your console window)

try: collectionA.add(collectionB.models)

If you are trying to add an object array to a collection try this:

_.each(kids.result, function(kid){ collectionA.add(new Backbone.Model(kid)); });

本文标签: javascripthow to add collection to another collection in BackboneStack Overflow