Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / src / widgets / grid / Column.js
index 12d1bc5..af23de2 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.3
+ * 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(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
-    this.renderer = this.renderer.createDelegate(this.scope || config);\r
-\r
-    if(this.editor){\r
-        this.editor = Ext.create(this.editor, 'textfield');\r
-    }\r
-};\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
@@ -232,6 +216,24 @@ var grid = new Ext.grid.GridPanel({
      * 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
@@ -283,7 +285,7 @@ var grid = new Ext.grid.GridPanel({
         }\r
         return null;\r
     }\r
-};\r
+});\r
 \r
 /**\r
  * @class Ext.grid.BooleanColumn\r
@@ -379,7 +381,7 @@ Ext.grid.TemplateColumn = Ext.extend(Ext.grid.Column, {
      */\r
     constructor: function(cfg){\r
         Ext.grid.TemplateColumn.superclass.constructor.call(this, cfg);\r
-        var tpl = 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