Search code examples
javascriptajaxcollectionsbackbone.jstrello

How do I populate sub-collections using Backbone?


I am using Trello API( http://trello.com) , and find that I can actually fetch sub-collections instead of using AJAX to fetch multiple times. For example, I can fetch cards using:

https://api.trello.com/1/boards/4eea4ffc91e31d1746000046?
lists=open&list_fields=name&cards=open&card_fields=name,desc
&key=[application_key]

So I can decrease loading latency by fetching data at one time, but I do not know how to populate this into sub-collections and avoiding the first automatic sync.

Any ideas on this?


Solution

  • Once you have the data you can use Collection.reset() to populate Collections without fetch them.