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

Instance Methods

Field Detail

inverse String

Specifies 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
isMaster Boolean

If set, determines that when an inverse relationship changes whether this record should become dirty also or not.

Default value:
YES

Instance Method Detail

inverseDidAddRecord(record, key, inverseRecord, inverseKey)

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.

Parameters:
record SC.Record
the record owning this attribute
key String
the key for this attribute
inverseRecord SC.Record
record that was added to inverse
inverseKey String
key on inverse that was modified
inverseDidRemoveRecord(record, key, inverseRecord, inverseKey)

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.

Parameters:
record SC.Record
the record owning this attribute
key String
the key for this attribute
inverseRecord SC.Record
record that was removed from inverse
inverseKey String
key on inverse that was modified
Documentation generated by JsDoc Toolkit 2.4.0 on Wed Apr 08 2015 10:02:21 GMT-0600 (CST)