Skip to content

Instantly share code, notes, and snippets.

@tim-evans
Created July 1, 2011 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tim-evans/1058755 to your computer and use it in GitHub Desktop.
Save tim-evans/1058755 to your computer and use it in GitHub Desktop.
Binding bug??
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