Class AdapterPopulatedRecordArray
Represents an ordered list of records whose order and membership is
determined by the adapter. For example, a query sent to the adapter
may trigger a search on the server, whose results would be loaded
into an instance of the AdapterPopulatedRecordArray
.
If you want to update the array and get the latest records from the
adapter, you can invoke update()
:
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
// GET /users?isAdmin=true store.query('user', { isAdmin: true }).then(function(admins) { admins.then(function() { console.log(admins.get("length")); // 42 }); // somewhere later in the app code, when new admins have been created // in the meantime // // GET /users?isAdmin=true admins.update().then(function() { admins.get('isUpdating'); // false console.log(admins.get("length")); // 123 }); admins.get('isUpdating'); // true } |
_dissociateFromOwnRecords
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:233
_pushIdentifiers (identifiers)
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:247
- identifiers
- StableRecordIdentifier[]
Adds identifiers to the RecordArray
without duplicates
_removeIdentifiers (identifiers)
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:258
- identifiers
- StableRecordIdentifier[]
Removes identifiers from the RecordArray
.
_setIdentifiers (identifiers, payload)
Defined in ../store/addon/-private/system/record-arrays/adapter-populated-record-array.js:101
- identifiers
- StableRecordIdentifier[]
- payload
- Object
- normalized payload
_takeSnapshot
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:269
save PromiseArray
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:174
- returns
- PromiseArray
- promise
Saves all of the records in the RecordArray
.
Example
1 2 3 4 5 |
let messages = store.peekAll('message'); messages.forEach(function(message) { message.set('hasBeenSeen', true); }); messages.save(); |
update
Inherited from RecordArray ../store/addon/-private/system/record-arrays/record-array.js:127
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 |
let people = store.peekAll('person'); people.get('isUpdating'); // false people.update().then(function() { people.get('isUpdating'); // false }); people.get('isUpdating'); // true |