Skip to content

Instantly share code, notes, and snippets.

@wookiehangover
Created September 19, 2013 20:42
Show Gist options
  • Save wookiehangover/6629545 to your computer and use it in GitHub Desktop.
Save wookiehangover/6629545 to your computer and use it in GitHub Desktop.
onFilterComplete_: function(collection){
if( this.isLoaded() && !this.loading_ ){
var newItems = _.difference(
_.pluck(collection.models, 'cid'),
_.keys(this.itemCardViews_)
);
// empty collections or collections with any unrendered items should be
// re-rendered, otherwise return early
if( collection.length !== 0 &&
this.renderCount_ === collection.length &&
newItems.length === 0
){
return;
}
console.debug(this.cid + ' re-rendering due to filter change');
this.renderCount_ = 0;
this.$('.items.main').empty();
this.renderItemList_();
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment