|
|
|
|
|
by nathanhammond
4439 days ago
|
|
I much prefer a basic construct that makes it simple to do filtering and sorting that can be simply extended to any complexity. Sorting and filtering are really nothing more than set manipulation (which they state themselves) so with simple data binding this becomes a trivial exercise to build an impressive client-side search. In Ember that might look like this: Ember.ArrayController.extend({
filterA: Ember.computed.filter('fieldName1', function comparator() {}),
filterB: Ember.computed.filter('fieldName2', function comparator() {}),
joined: Ember.computed.union('filterA', 'filterB'),
filtered: Ember.computed.uniq('joined'),
sorted: Ember.computed.sort(function comparator() {})
});
|
|