DS.FilteredRecordArray
DS.FilteredRecordArray Class
Extends: DS.RecordArray
Defined in: addon/-private/system/record-arrays/filtered-record-array.js:10
Module: ember-data
Represents a list of records whose membership is determined by the store. As records are created, loaded, or modified, the store evaluates them to determine if they should be part of the record array.
filterFunction (record) Boolean
The filterFunction is a function used to test records from the store to determine if they should be part of the record array.
Example
var allPeople = store.peekAll('person'); allPeople.mapBy('name'); // ["Tom Dale", "Yehuda Katz", "Trek Glowacki"] var people = store.filter('person', function(person) { if (person.get('name').match(/Katz$/)) { return true; } }); people.mapBy('name'); // ["Yehuda Katz"] var notKatzFilter = function(person) { return !person.get('name').match(/Katz$/); }; people.set('filterFunction', notKatzFilter); people.mapBy('name'); // ["Tom Dale", "Trek Glowacki"]
Parameters:
-
record
DS.Model
Returns:
-
Boolean
- `true` if the record should be in the array
updateFilterprivate
© 2017 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://emberjs.com/api/data/classes/DS.FilteredRecordArray.html