/*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.1.0
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
* <p>While subclasses are provided to render data in different ways, this class renders a passed\r
* data field unchanged and is usually used for textual columns.</p>\r
*/\r
-Ext.grid.Column = function(config){\r
- Ext.apply(this, config);\r
-\r
- if(typeof this.renderer == 'string'){\r
- this.renderer = Ext.util.Format[this.renderer];\r
- } else if(Ext.isObject(this.renderer)){\r
- this.scope = this.renderer.scope;\r
- this.renderer = this.renderer.fn;\r
- }\r
- this.renderer = this.renderer.createDelegate(this.scope || config);\r
-\r
- if(this.id === undefined){\r
- this.id = ++Ext.grid.Column.AUTO_ID;\r
- }\r
- if(this.editor){\r
- this.editor = Ext.create(this.editor, 'textfield');\r
- }\r
-};\r
-\r
-Ext.grid.Column.AUTO_ID = 0;\r
-\r
-Ext.grid.Column.prototype = {\r
+Ext.grid.Column = Ext.extend(Object, {\r
/**\r
* @cfg {Boolean} editable Optional. Defaults to <tt>true</tt>, enabling the configured\r
* <tt>{@link #editor}</tt>. Set to <tt>false</tt> to initially disable editing on this column.\r
*/\r
/**\r
* @cfg {Boolean} sortable Optional. <tt>true</tt> if sorting is to be allowed on this column.\r
- * Defaults to the value of the {@link #defaultSortable} property.\r
- * Whether local/remote sorting is used is specified in {@link Ext.data.Store#remoteSort}.\r
+ * Defaults to the value of the <code>{@link Ext.grid.ColumnModel#defaultSortable}</code> property.\r
+ * Whether local/remote sorting is used is specified in <code>{@link Ext.data.Store#remoteSort}</code>.\r
*/\r
/**\r
* @cfg {Boolean} fixed Optional. <tt>true</tt> if the column width cannot be changed. Defaults to <tt>false</tt>.\r
* @cfg {Boolean} menuDisabled Optional. <tt>true</tt> to disable the column menu. Defaults to <tt>false</tt>.\r
*/\r
/**\r
- * @cfg {Boolean} hidden Optional. <tt>true</tt> to hide the column. Defaults to <tt>false</tt>.\r
+ * @cfg {Boolean} hidden\r
+ * Optional. <tt>true</tt> to initially hide this column. Defaults to <tt>false</tt>.\r
+ * A hidden column {@link Ext.grid.GridPanel#enableColumnHide may be shown via the header row menu}.\r
+ * If a column is never to be shown, simply do not include this column in the Column Model at all. \r
*/\r
/**\r
* @cfg {String} tooltip Optional. A text string to use as the column header's tooltip. If Quicktips\r
* if editing is supported by the grid. See <tt>{@link #editable}</tt> also.\r
*/\r
\r
- // private. Used by ColumnModel to avoid reprocessing\r
+ /**\r
+ * @private\r
+ * @cfg {Boolean} isColumn\r
+ * Used by ColumnModel setConfig method to avoid reprocessing a Column\r
+ * if <code>isColumn</code> is not set ColumnModel will recreate a new Ext.grid.Column\r
+ * Defaults to true.\r
+ */\r
isColumn : true,\r
+ \r
+ constructor : function(config){\r
+ Ext.apply(this, config);\r
+\r
+ if(Ext.isString(this.renderer)){\r
+ this.renderer = Ext.util.Format[this.renderer];\r
+ }else if(Ext.isObject(this.renderer)){\r
+ this.scope = this.renderer.scope;\r
+ this.renderer = this.renderer.fn;\r
+ }\r
+ if(!this.scope){\r
+ this.scope = this;\r
+ }\r
+\r
+ if(this.editor){\r
+ this.editor = Ext.create(this.editor, 'textfield');\r
+ }\r
+ },\r
+\r
/**\r
* Optional. A function which returns displayable data when passed the following parameters:\r
* <div class="mdetail-params"><ul>\r
* @type Function\r
*/\r
renderer : function(value){\r
- if(typeof value == 'string' && value.length < 1){\r
+ if(Ext.isString(value) && value.length < 1){\r
return ' ';\r
}\r
return value;\r
}\r
return null;\r
}\r
-};\r
+});\r
\r
/**\r
* @class Ext.grid.BooleanColumn\r
* @extends Ext.grid.Column\r
- * <p>A Column definition class which renders boolean data fields. See the {@link Ext.grid.ColumnModel#xtype xtype}\r
- * config option of {@link Ext.grid.ColumnModel} for more details.</p>\r
+ * <p>A Column definition class which renders boolean data fields. See the {@link Ext.grid.Column#xtype xtype}\r
+ * config option of {@link Ext.grid.Column} for more details.</p>\r
*/\r
Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, {\r
/**\r
* @class Ext.grid.NumberColumn\r
* @extends Ext.grid.Column\r
* <p>A Column definition class which renders a numeric data field according to a {@link #format} string. See the\r
- * {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more details.</p>\r
+ * {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column} for more details.</p>\r
*/\r
Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, {\r
/**\r
* @class Ext.grid.DateColumn\r
* @extends Ext.grid.Column\r
* <p>A Column definition class which renders a passed date according to the default locale, or a configured\r
- * {@link #format}. See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel}\r
+ * {@link #format}. See the {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column}\r
* for more details.</p>\r
*/\r
Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {\r
* @extends Ext.grid.Column\r
* <p>A Column definition class which renders a value by processing a {@link Ext.data.Record Record}'s\r
* {@link Ext.data.Record#data data} using a {@link #tpl configured} {@link Ext.XTemplate XTemplate}.\r
- * See the {@link Ext.grid.ColumnModel#xtype xtype} config option of {@link Ext.grid.ColumnModel} for more\r
+ * See the {@link Ext.grid.Column#xtype xtype} config option of {@link Ext.grid.Column} for more\r
* details.</p>\r
*/\r
Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, {\r
*/\r
constructor: function(cfg){\r
Ext.grid.TemplateColumn.superclass.constructor.call(this, cfg);\r
- var tpl = typeof Ext.isObject(this.tpl) ? this.tpl : new Ext.XTemplate(this.tpl);\r
+ var tpl = (!Ext.isPrimitive(this.tpl) && this.tpl.compile) ? this.tpl : new Ext.XTemplate(this.tpl);\r
this.renderer = function(value, p, r){\r
return tpl.apply(r.data);\r
};\r