mercredi 16 septembre 2015

What is the best way to filter/search through large data sets in Ember?

Say I am filtering a list of 25,000 songs based on a searchTerm:

export default Ember.Controller.extend({ (...)
  matchingSongs: Ember.computed('searchTerm', function() {
    return this.get('model.songs').filter(function(song) {
       return song.get('title').indexOf(searchTerm) !== -1;
    });
  })
})

This feels a little laggy. Is this the right way to go about it in Ember 2.0? Or should I delegate the searching to the server?




Aucun commentaire:

Enregistrer un commentaire