KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have an application which consists of a Backbone.js collection and real-time connection to the server. Every time any client adds / removes / updates a model in the collection, the updated collection is broadcasted to all other clients (not the delta; the whole collection). When handling this update event from the other clients, the only way I've found of updating the collection is a reset(). Unfortunately, this wipes the old models and creates new ones, along with all the view-related side-effects. Is there a Backbone-sanctioned way of updating a collection that maintains and updates the original models (comparing by id), creating / deleting them only if necessary? UPDATE Backbone has added the Collection.set method, which is capable of updating existing models.
Tags (comma-separated)
Save Edits
Cancel