Class: SC.ManyArray
Extends
SC.Array, SC.Enumerable.
A ManyArray
is used to map an array of record ids back to their
record objects which will be materialized from the owner store on demand.
Whenever you create a toMany()
relationship, the value returned from the
property will be an instance of ManyArray
. You can generally customize the
behavior of ManyArray by passing settings to the toMany()
helper.
Defined in: many_array.js
- Since:
- SproutCore 1.0
Field Summary
- Fields borrowed from SC.Enumerable:
- isEnumerable
- Fields borrowed from SC.Array:
- isSCArray
Instance Methods
- addInverseRecord(inverseRecord)
- editableStoreIds()
- inverse()
- isEditable()
- isMaster()
- orderBy()
- readOnlyStoreIds()
- removeInverseRecord(inverseRecord)
- store()
- storeKey()
- toString()
- updateNewRecordId(rec)
Field Detail
manyAttribute SC.ManyAttribute- Default value:
- null
If set will be used by the many array to get an editable version of the
storeIds
from the owner.
- Default value:
- null
If set, the record will be notified whenever the array changes so that it can change its own state
- Default value:
- null
recordType
will tell what type to transform the record to when
materializing the record.
- Default value:
- null
Determines whether the new record (i.e. unsaved) support should be enabled or not.
Normally, all records in the many array should already have been previously
committed to a remote data store and have an actual id
. However, with
supportNewRecords
set to true, adding records without an id
to the many
array will assign unique temporary ids to the new records.
Note:* You must update the many array after the new records are successfully
committed and have real ids. This is done by calling updateNewRecordId()
on the many array. In the future this should be automatic.
- Default value:
- false
- Since:
- SproutCore 1.11.0
Instance Method Detail
Called by the ManyAttribute
whenever a record is added on the inverse
of the relationship.
- Parameters:
- inverseRecord SC.Record
- the record this array is a part of
- Returns:
- SC.ManyArray
- receiver
Returns an editable array of storeId
s. Marks the owner records as
modified.
Returns the storeId
s in read-only mode. Avoids modifying the record
unnecessarily.
Called by the ManyAttribute
whenever a record is removed on the inverse
of the relationship.
- Parameters:
- inverseRecord SC.Record
- the record that was removed
- Returns:
- SC.ManyArray
- receiver
The store that owns this record array. All record arrays must have a store to function properly.
The storeKey
for the parent record of this many array. Editing this
array will place the parent record into a READY_DIRTY
state.
Call this when a new record that was added to the many array previously
has been committed and now has a proper id
. This will fix up the temporary
id that was used to allow the new record to be a part of this many array.
- Parameters:
- rec
- Returns:
- void