sorting - Backbone sort method -
i have following code :
campaign.collection = backbone.collection.extend({initialize: function() { }, comparator: function(item) { return item.get('name'); } }
i call collection.sort() , seems work , sorts models regarding name field problem gives higher priority uppercase letters example ('some test' < 'more test') there way override behavior ?
the easiest fix following:
campaign.collection = backbone.collection.extend({ initialize: function() {}, comparator: function(item) { return item.get('name').tolowercase(); } };
this convert lower case before comparing compare in manner ignores case.
Comments
Post a Comment