Skip to content

Instantly share code, notes, and snippets.

View PaRoxUs's full-sized avatar

Pontus Karlsson PaRoxUs

  • Obaxu
  • Mölnbo, Sweden
View GitHub Profile
@nordyke
nordyke / MultiSortCollection.js
Created December 27, 2011 15:38
Multi-sort on any number of Backbone Collection attributes. Sort happens from arguments[0] to arguments[n]
var MultiSortCollection = Backbone.Collection.extend({
/**
* Sort by supplied attributes. First param is sorted first, and
* last param is final subsort
* @param {String} sortAttributes
* @example collection.sortBy("last_name","first_name")
*/
sortBy : function(sortAttributes){
var attributes = arguments;