Class: SC.SingleAttribute
Extends
SC.RecordAttribute.
SingleAttribute
is a subclass of RecordAttribute
and handles to-one
relationships.
There are many ways you can configure a SingleAttribute
:
group: SC.Record.toOne('MyApp.Group', {
inverse: 'contacts', // set the key used to represent the inverse
isMaster: YES|NO, // indicate whether changing this should dirty
transform: function(), // transforms value <=> storeKey,
isEditable: YES|NO, make editable or not
});
Defined in: single_attribute.js
- Since:
- SproutCore 1.0
Field Summary
- Fields borrowed from SC.RecordAttribute:
- aggregate, defaultValue, isEditable, isRecordAttribute, isRequired, key, lazilyInstantiate, type, useIsoDate
- Fields borrowed from SC.Object:
- concatenatedProperties, isDestroyed, isObject, nextProperty, object, property, target, toInvalidate
- Fields borrowed from SC.Observable:
- isObservable
Instance Methods
- inverseDidAddRecord(record, key, inverseRecord, inverseKey)
- inverseDidRemoveRecord(record, key, inverseRecord, inverseKey)
Field Detail
inverse StringSpecifies the property on the member record that represents the inverse of the current relationship. If set, then modifying this relationship will also alter the opposite side of the relationship.
- Default value:
- null
If set, determines that when an inverse relationship changes whether this record should become dirty also or not.
- Default value:
- YES
Instance Method Detail
Called by an inverse relationship whenever the receiver is added to the inverse relationship. This will set the value of this inverse record to the new record.
Called by an inverse relationship whenever the receiver is no longer part of the relationship. If this matches the inverse setting of the attribute then it will update itself accordingly.