javascript - Alphabetically sorting a backbone collection using a key -


i have collection needs sorted on particular key ('display'), know backbone has default comparator not defined default, @ loss of how implement it

 var listcollection = new backbone.collection(rebuiltarray.map(function(text){   return {     attribute: text,     displaynames: displaynames[text]   };   })); 

thanks in advance help

try following

 var listcollection = backbone.collection.extend({      comparator: 'displaynames'  });   var listcollection = new listcollection(rebuiltarray.map(function(text){     return {         attribute: text,         displaynames: displaynames[text]     };  })); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -