Sha256: da22ec168c77ea2c44ab75e0ecb327dd9c233a2df869a22c4f77f9d633a43639

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

// ========================================================================
// SproutCore
// copyright 2006-2007 Sprout Systems, Inc.
// ========================================================================

/**
  Apply this mixin to any view class to automatically inherit most of the
  basic properties you need to support to act as an item view in a collection.
  
  In addition to this module, make sure that your view class knows how to
  render the object set on the 'content' property.
  
  This module provides both the properties and reasonable default observers.
  You can override them in your own class as well.
  
  @namespace
*/
SC.CollectionItem = {
  
  /** Set to true when the item is selected. */
  isSelected: false,
  
  /** By default, adds the 'sel' CSS class if selected. */
  isSelectedObserver: function() {
    this.setClassName('sel', this.get('isSelected')) ;
  }.observes('isSelected'),
  
  /** Set to true when the item is enabled. */
  isEnabled: true,
  
  /** By default, adds the disabled CSS class if disabled. */
  isEnabledObserver: function() {
    this.setClassName('disabled', !this.get('isEnabled'));
  }.observes('isEnabled')
  
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sproutcore-0.9.1 frameworks/sproutcore/views/collection/collection_item.js