1 // ==========================================================================
  2 // Project:   SproutCore - JavaScript Application Framework
  3 // Copyright: ©2006-2011 Strobe Inc. and contributors.
  4 //            Portions ©2008-2011 Apple, Inc. All rights reserved.
  5 // License:   Licensed under MIT license (see license.js)
  6 // ==========================================================================
  7 
  8 
  9 SC.SORT_ASCENDING  = 'ascending';
 10 SC.SORT_DESCENDING = 'descending';
 11 
 12 /** @class
 13 
 14   An abstract object that manages the state of the columns behind a
 15   `SC.TableView`.
 16   
 17   @extends SC.Object
 18   @since SproutCore 1.1
 19 */
 20 
 21 SC.TableColumn = SC.Object.extend({
 22 /** @scope SC.TableColumn.prototype */
 23   
 24   /**
 25     The internal name of the column. `SC.TableRowView` objects expect their
 26     `content` to be an object with keys corresponding to the column's keys.
 27     
 28     @property
 29     @type String
 30   */
 31   key: null,
 32   
 33   /**
 34     The display name of the column. Will appear in the table header for this
 35     column.
 36     
 37     @property
 38     @type String
 39   */
 40   title: null,
 41   
 42   /**
 43     Width of the column.
 44     
 45     @property
 46     @type Number
 47   */
 48   width: 100,
 49   
 50   /**
 51     How narrow the column will allow itself to be.
 52     
 53     @property
 54     @type Number
 55   */
 56   minWidth: 16,
 57   
 58   /**
 59     How wide the column will allow itself to be.
 60     
 61     @property
 62     @type Number
 63   */
 64   maxWidth: 700,
 65   
 66   escapeHTML: NO,
 67 
 68   formatter: null,
 69 
 70   
 71   isVisible: YES,
 72   
 73   /**
 74     Whether the column gets wider or narrower based on the size of the
 75     table. Only one column in a TableView is allowed to be flexible.
 76     
 77     @property
 78     @type Boolean
 79   */
 80   isFlexible: NO,
 81   
 82   /**
 83     Whether the column can be drag-reordered.
 84     
 85     @property
 86     @type Boolean
 87   */
 88   isReorderable: YES,
 89   
 90   /**
 91     Whether the column can be sorted.
 92     
 93     @property
 94     @type Boolean
 95   */
 96   isSortable: YES,
 97 
 98   /**
 99     Reference to the URL for this column's icon. If `null`, there is no
100     icon associated with the column.
101     @property
102   */
103   icon: null,
104   
105   tableHeader: null,
106 
107   /**
108     The sort state of this particular column. Can be one of
109     SC.SORT_ASCENDING, SC.SORT_DESCENDING, or `null`. For instance, if
110     SC.SORT_ASCENDING, means that the table is being sorted on this column
111     in the ascending direction. If `null`, means that the table is sorted
112     on another column.
113     
114     @property
115   */
116   sortState: null,
117   
118   /**
119     The content property of the controlling SC.TableView. This is needed
120     because the SC.TableHeader views use this class to find out how to
121     render table content (when necessary).
122   */
123   tableContent: null
124   
125 });
126