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
1 Answer
Reset to default 11Assuming 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
版权声明:本文标题:javascript - how to add collection to another collection in Backbone - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741520517a2383153.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论