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

Instance Methods

Field Detail

manyAttribute SC.ManyAttribute
The `ManyAttribute` that created this array.
Default value:
null
propertyName String

If set will be used by the many array to get an editable version of the storeIds from the owner.

Default value:
null
record SC.Record

If set, the record will be notified whenever the array changes so that it can change its own state

Default value:
null
recordType String

recordType will tell what type to transform the record to when materializing the record.

Default value:
null
supportNewRecords Boolean

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 idto 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

addInverseRecord(inverseRecord)

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
editableStoreIds()

Returns an editable array of storeIds. Marks the owner records as modified.

inverse()
Computed from owner many attribute
isEditable()
Computed from owner many attribute
isMaster()
Computed from owner many attribute
orderBy()
Computed from owner many attribute
readOnlyStoreIds()

Returns the storeIds in read-only mode. Avoids modifying the record unnecessarily.

removeInverseRecord(inverseRecord)

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
store()

The store that owns this record array. All record arrays must have a store to function properly.

storeKey()

The storeKey for the parent record of this many array. Editing this array will place the parent record into a READY_DIRTY state.

toString()
updateNewRecordId(rec)

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
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:20 GMT-0600 (CST)