Monday, October 21, 2013

using underscore.js to sort a collection

dictionary.queryFilter(query).fetch().then(lang.hitch(this, function(entries) {
   entries.forEach(function(entry) {
      items.push({
         label: entry.name,
         value: entry.number
      });
   });
   items = _.sortBy(items, function(item){ return item.value });

No comments:

Post a Comment