Skip to content

Instantly share code, notes, and snippets.

@thomaslang
Created August 21, 2009 11:26
Show Gist options
  • Save thomaslang/171882 to your computer and use it in GitHub Desktop.
Save thomaslang/171882 to your computer and use it in GitHub Desktop.
contentView: SC.ListView.design({
listItemActionProperty: 'action',
contentValueKey: "title",
contentBinding: "BB.associationListController.arrangedObjects",
exampleView: SC.ListItemView.extend({
renderAction: function(context, actionClassName){
context.push('<img src="',
SC.BLANK_IMAGE_URL,
'" class="action sc-mini-icon plus" />');
},
mouseDown: function(evt) {
// if inside action icon
if (this._isInsideElementWithClassName('action', evt)) {
console.log('action triggered');
return YES; // listItem should handle this event
}
// if occurred inside checkbox, item view should handle the event.
if (this._isInsideCheckbox(evt)) {
this._addCheckboxActiveState() ;
this._isMouseDownOnCheckbox = YES ;
this._isMouseInsideCheckbox = YES ;
return YES ; // listItem should handle this event
} else if (this._isInsideDisclosure(evt)) {
this._addDisclosureActiveState();
this._isMouseDownOnDisclosure = YES;
this._isMouseInsideDisclosure = YES ;
return YES;
}
return NO ; // let the collection view handle this event
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment