Created
July 1, 2011 15:16
-
-
Save tim-evans/1058755 to your computer and use it in GitHub Desktop.
Binding bug??
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MO.SelectableListItemView = SC.View.extend( | |
/** @scope MO.SelectableListItemView.prototype */{ | |
/** | |
@type SC.Hash | |
@default { bottom: 1 } | |
@see SC.View#border | |
*/ | |
border: { bottom: 1 }, | |
/** | |
@type Array | |
@default ['item', 'checkbox'] | |
@see SC.View#childViews | |
*/ | |
childViews: ['item', 'checkbox'], | |
/** | |
Initially, the item is unselected. | |
@type Boolean | |
@default NO | |
*/ | |
isSelectedBinding: '.checkbox*isSelected', | |
checkbox: SC.CheckboxView.design({ | |
layout: { left: 0, top: 0, right: 0, bottom: 0 } | |
}), | |
/** @private | |
Reverse proxy the `isSelected` to the `parentView`'s selection set. | |
*/ | |
_morcli_isSelectedDidChange: function () { | |
if (this.get('isSelected')) { | |
this.get('parentView').select(this.get('contentIndex')); | |
} else { | |
this.get('parentView').deselect(this.get('contentIndex')); | |
} | |
}.observes('isSelected') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment