User1234894
User1234894

Reputation: 13

Is Backbone.js Collection Refresh method still available?

The refresh method on the Collection class is documented here: http://documentcloud.github.com/backbone/#Collection-refresh

Yet, when I call the method, I get "is not a function" error. Also, looking at the DOM w/ Firebug, the refresh method is not present on my Collection. Even looking through the backbone.js source, I see no definition of a refresh method.

Is the refresh method still available? If not, why was it removed? How do I update the collection in bulk?

Upvotes: 0

Views: 2873

Answers (1)

Raynos
Raynos

Reputation: 169511

You need to call .refresh on an instance of a Collection.

var Col = Backbone.Collection.extend({ ... });
Col.refresh(); // INVALID
(new Col).refresh(); // VALID

.refresh source code

If your looking at the latest source code on the master branch then it's been renamed to reset. Please use the latest stable version. When the release the new stable version (0.3.4) They will update the documentation to mention reset

Upvotes: 1

Related Questions