How does Backbone reset event works?
As far as I understand
- Remove all models from collection
- Add newly "fetched" models to collection
- Fires reset event
In my case each model draw something on SVG so I should call remove function before removing model from collection. Which event is triggered when model is removed from collection?
Best Answer
As @Paul noted, there is no predefined event fired before a
reset
. However, you can provide your own by overriding thereset
method on your collection. For example,And a sample usage
See http://jsfiddle.net/nikoshr/8vV7Y/ for a demo
You could also trigger events on each model.