Collection.bind('change',this.function, this);
Collection.bind('add',this.function, this);
Collection.bind('remove',this.function, this);
Collection.bind('reset',this.function, this);
I know these four, but what are the rest?
What about model binds? What are the events for those?
How come I can't find a documentation specifying all the binds....
Collection.bind('change',this.function, this);
Collection.bind('add',this.function, this);
Collection.bind('remove',this.function, this);
Collection.bind('reset',this.function, this);
I know these four, but what are the rest?
What about model binds? What are the events for those?
How come I can't find a documentation specifying all the binds....
Share Improve this question asked Dec 7, 2011 at 7:44 TIMEXTIMEX 272k367 gold badges800 silver badges1.1k bronze badges 1- as Thilo says, they are in the FAQ, but keep in mind you can always .trigger('mycustomevent') and bind to your custom event too... you are not limited to the default events! it all depends what you are trying to achieve of course. – Sander Commented Dec 7, 2011 at 10:12
1 Answer
Reset to default 25It is a bit hidden in the FAQ.
- "add" (model, collection) — when a model is added to a collection.
- "remove" (model, collection) — when a model is removed from a collection.
- "reset" (collection) — when the collection's entire contents have been replaced.
- "change" (model, collection) — when a model's attributes have changed.
- "change:[attribute]" (model, collection) — when a specific attribute has been updated.
- "destroy" (model, collection) — when a model is destroyed.
- "error" (model, collection) — when a model's validation fails, or a save call fails on the server.
- "route:[name]" (router) — when one of a router's routes has matched.
- "all" — this special event fires for any triggered event, passing the event name as the first argument.