On this page
Class DS.FilteredRecordArray
Extends: | DS.RecordArray |
---|---|
Defined in: | addon/-private/system/record-arrays/filtered-record-array.js:5 |
Module: | ember-data |
filterFunction (record) Boolean
Module: | ember-data |
---|
Defined in addon/-private/system/record-arrays/filtered-record-array.js:22
- record
- DS.Model
- returns
- Boolean
- `true` if the record should be in the array
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"]
save DS.PromiseArray
Module: | ember-data |
---|
Inherited from DS.RecordArray addon/-private/system/record-arrays/record-array.js:182
- returns
- DS.PromiseArray
- promise
Saves all of the records in the RecordArray
.
Example
var messages = store.peekAll('message');
messages.forEach(function(message) {
message.set('hasBeenSeen', true);
});
messages.save();
update
Module: | ember-data |
---|
Inherited from DS.RecordArray addon/-private/system/record-arrays/record-array.js:114
Used to get the latest version of all of the records in this array from the adapter.
Example
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update().then(function() {
people.get('isUpdating'); // false
});
people.get('isUpdating'); // true
© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember-data/2.18/classes/DS.FilteredRecordArray/methods