Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: PaulUithol/Backbone-relational
base: 2b1c10bf95
...
head fork: PaulUithol/Backbone-relational
compare: 080b8268e2
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 18, 2012
@DouweM DouweM Fire `relational:reset` and thus `related:reset` events on-sort, like…
… Backbone fires `reset`.
89a16c5
Commits on Apr 23, 2012
@PaulUithol Merge pull request #107 from DouweM/reset-event-on-sort
Fire `relational:reset` and thus `related:reset` events on-sort.
080b826
Showing with 12 additions and 1 deletion.
  1. +12 −1 backbone-relational.js
View
13 backbone-relational.js
@@ -1356,7 +1356,18 @@
var reset = Backbone.Collection.prototype.__reset = Backbone.Collection.prototype.reset;
Backbone.Collection.prototype.reset = function( models, options ) {
reset.call( this, models, options );
- this.trigger( 'relational:reset', models, options );
+ this.trigger( 'relational:reset', this, options );
+
+ return this;
+ };
+
+ /**
+ * Override 'Backbone.Collection.sort' to trigger 'relational:reset'.
+ */
+ var sort = Backbone.Collection.prototype.__sort = Backbone.Collection.prototype.sort;
+ Backbone.Collection.prototype.sort = function( options ) {
+ sort.call( this, options );
+ this.trigger( 'relational:reset', this, options );
return this;
};

No commit comments for this range

Something went wrong with that request. Please try again.