Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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