Y
Y
yeputons2011-05-12 05:17:13
crowdsourcing
yeputons, 2011-05-12 05:17:13

Backbone.js - updating collections from server with add/remove alerts?

Good morning.
I recently read an article about backbone.js and wanted to give it a try. The following question arose: when the fetch () method is called from the collection, a request is made to the server and the refresh () method that stupidly deletes all elements and creates new ones - those that came from the server.
The question is - is it possible to somehow synchronize with the server so that I am notified if something is deleted / added / changed on the server (it has priority - server or local changes, not very important yet)? I know about the “write your own refresh” option. Maybe something like this already exists?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MastaEx, 2011-05-12
@MastaEx

If I understood you correctly, then you want the server to inform the client about the changes that have occurred. If so, then it has little to do with Backbone, see options . And then it all depends on your imagination, do you want to do atomic synchronization, do you want to drive the entire collection back and forth and update via refresh.
In general, the question is somewhat chaotic.

P
personaljs, 2013-11-22
@personaljs

backbone has collection events. Hang add,remove events on your collection and your function when these events fire after fetching the collection

V
Vasily Ostanin, 2013-12-10
@bazilio91

I can recommend
sailsjs.org
net.tutsplus.com/tutorials/javascript-ajax/working...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question