DS.FilteredRecordArray#filterFunction()

filterFunction (record) Boolean

Defined in addon/-private/system/record-arrays/filtered-record-array.js:21

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
doc_EmberJs
2016-11-30 16:49:39
Comments
Leave a Comment

Please login to continue.