Skip to content

Instantly share code, notes, and snippets.

@amacdougall
Created July 16, 2012 16:22
Show Gist options
  • Save amacdougall/3123594 to your computer and use it in GitHub Desktop.
Save amacdougall/3123594 to your computer and use it in GitHub Desktop.
Collection filtering idea
var collection = new DataCollection(apiURL);
collection.pageSize = 20;
collection.filters = {
recommended: function(element) {
return element.isRecommended;
},
favorite: function(element) {
return element.isFavorite;
}
};
var firstTwentyElements = collection.loadPage();
collection.filter("favorite");
var firstTwentyFavorites = collection.loadPage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment