When I create a new collection, fetch is called automatically once. This gives me the “first page”, as well as the URL to the next page + certain number of entries. Now, what I need to do is to populate this collection (all at once, in the beginning) by calling fetch repeatedly until the next page field is undefined.
How can I do this? It seems like if I call fetch with a callback (success) function, it only calls that ONCE. So something like:
fetch(success: function () {
if (condition)
fetch again
});
It does not call fetch repeatedly (until if condition is false). Instead, it calls it once, and since the “fetch again” part was not passed in a success function, it does not have a callback?
How can I get around this? What’s the best approach? Thanks!
Just name the function and pass it into the inner call.
Example (from the view):
HERE is an example.