Class DS.FilteredRecordArray

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.

Show:

Module: ember-data
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

1
2
3
4
5
6
7
8
9
10
11
12
13
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"]
Module: ember-data
returns
DS.PromiseArray
promise

Saves all of the records in the RecordArray.

Example

1
2
3
4
5
var messages = store.peekAll('message');
messages.forEach(function(message) {
  message.set('hasBeenSeen', true);
});
messages.save();
Module: ember-data

Used to get the latest version of all of the records in this array from the adapter.

Example

1
2
3
4
5
6
7
8
var people = store.peekAll('person');
people.get('isUpdating'); // false

people.update().then(function() {
  people.get('isUpdating'); // false
});

people.get('isUpdating'); // true