Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / pkgs / pkg-grid-foundation-debug.js
index 4ea017c..a53117c 100644 (file)
@@ -1,6 +1,6 @@
 /*!
- * Ext JS Library 3.0.0
- * Copyright(c) 2006-2009 Ext JS, LLC
+ * Ext JS Library 3.1.1
+ * Copyright(c) 2006-2010 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
  */
  * <p>Example usage:</p>\r
  * <pre><code>\r
 var grid = new Ext.grid.GridPanel({\r
-    {@link #store}: new (@link Ext.data.Store}({\r
+    {@link #store}: new {@link Ext.data.Store}({\r
         {@link Ext.data.Store#autoDestroy autoDestroy}: true,\r
         {@link Ext.data.Store#reader reader}: reader,\r
         {@link Ext.data.Store#data data}: xg.dummyData\r
     }),\r
-    {@link #columns}: [\r
-        {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},\r
-        {header: 'Price', width: 120, sortable: true, renderer: Ext.util.Format.usMoney, dataIndex: 'price'},\r
-        {header: 'Change', width: 120, sortable: true, dataIndex: 'change'},\r
-        {header: '% Change', width: 120, sortable: true, dataIndex: 'pctChange'},\r
-        // instead of specifying renderer: Ext.util.Format.dateRenderer('m/d/Y') use xtype\r
-        {header: 'Last Updated', width: 135, sortable: true, dataIndex: 'lastChange', xtype: 'datecolumn', format: 'M d, Y'}\r
-    ],\r
+    {@link #colModel}: new {@link Ext.grid.ColumnModel}({\r
+        {@link Ext.grid.ColumnModel#defaults defaults}: {\r
+            width: 120,\r
+            sortable: true\r
+        },\r
+        {@link Ext.grid.ColumnModel#columns columns}: [\r
+            {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},\r
+            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price'},\r
+            {header: 'Change', dataIndex: 'change'},\r
+            {header: '% Change', dataIndex: 'pctChange'},\r
+            // instead of specifying renderer: Ext.util.Format.dateRenderer('m/d/Y') use xtype\r
+            {\r
+                header: 'Last Updated', width: 135, dataIndex: 'lastChange',\r
+                xtype: 'datecolumn', format: 'M d, Y'\r
+            }\r
+        ],\r
+    }),\r
     {@link #viewConfig}: {\r
         {@link Ext.grid.GridView#forceFit forceFit}: true,\r
 \r
@@ -140,7 +149,9 @@ Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
      * @cfg {Boolean} enableColumnResize <tt>false</tt> to turn off column resizing for the whole grid. Defaults to <tt>true</tt>.\r
      */\r
     /**\r
-     * @cfg {Boolean} enableColumnHide Defaults to <tt>true</tt> to enable hiding of columns with the header context menu.\r
+     * @cfg {Boolean} enableColumnHide\r
+     * Defaults to <tt>true</tt> to enable {@link Ext.grid.Column#hidden hiding of columns}\r
+     * with the {@link #enableHdMenu header menu}.\r
      */\r
     enableColumnHide : true,\r
     /**\r
@@ -206,19 +217,28 @@ Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
      * @cfg {Array} stateEvents\r
      * An array of events that, when fired, should trigger this component to save its state.\r
      * Defaults to:<pre><code>\r
-     * stateEvents: ['columnmove', 'columnresize', 'sortchange']\r
+     * stateEvents: ['columnmove', 'columnresize', 'sortchange', 'groupchange']\r
      * </code></pre>\r
      * <p>These can be any types of events supported by this component, including browser or\r
      * custom events (e.g., <tt>['click', 'customerchange']</tt>).</p>\r
      * <p>See {@link Ext.Component#stateful} for an explanation of saving and restoring\r
      * Component state.</p>\r
      */\r
-    stateEvents : ['columnmove', 'columnresize', 'sortchange'],\r
+    stateEvents : ['columnmove', 'columnresize', 'sortchange', 'groupchange'],\r
     /**\r
      * @cfg {Object} view The {@link Ext.grid.GridView} used by the grid. This can be set\r
      * before a call to {@link Ext.Component#render render()}.\r
      */\r
     view : null,\r
+    \r
+    /**\r
+     * @cfg {Array} bubbleEvents\r
+     * <p>An array of events that, when fired, should be bubbled to any parent container.\r
+     * See {@link Ext.util.Observable#enableBubble}. \r
+     * Defaults to <tt>[]</tt>.\r
+     */\r
+    bubbleEvents: [],\r
+    \r
     /**\r
      * @cfg {Object} viewConfig A config object that will be applied to the grid's UI view.  Any of\r
      * the config options available for {@link Ext.grid.GridView} can be specified here. This option\r
@@ -345,6 +365,33 @@ Ext.grid.GridPanel = Ext.extend(Ext.Panel, {
              * @param {Ext.EventObject} e\r
              */\r
             'headermousedown',\r
+            \r
+            /**\r
+             * @event groupmousedown\r
+             * Fires before a group header is clicked. <b>Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}</b>.\r
+             * @param {Grid} this\r
+             * @param {String} groupField\r
+             * @param {String} groupValue\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'groupmousedown',\r
+            \r
+            /**\r
+             * @event rowbodymousedown\r
+             * Fires before the row body is clicked. <b>Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.</b>\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowbodymousedown',\r
+            \r
+            /**\r
+             * @event containermousedown\r
+             * Fires before the container is clicked. The container consists of any part of the grid body that is not covered by a row.\r
+             * @param {Grid} this\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'containermousedown',\r
 \r
             /**\r
              * @event cellclick\r
@@ -406,6 +453,56 @@ function(grid, rowIndex, columnIndex, e) {
              * @param {Ext.EventObject} e\r
              */\r
             'headerdblclick',\r
+            /**\r
+             * @event groupclick\r
+             * Fires when group header is clicked. <b>Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}</b>.\r
+             * @param {Grid} this\r
+             * @param {String} groupField\r
+             * @param {String} groupValue\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'groupclick',\r
+            /**\r
+             * @event groupdblclick\r
+             * Fires when group header is double clicked. <b>Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}</b>.\r
+             * @param {Grid} this\r
+             * @param {String} groupField\r
+             * @param {String} groupValue\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'groupdblclick',\r
+            /**\r
+             * @event containerclick\r
+             * Fires when the container is clicked. The container consists of any part of the grid body that is not covered by a row.\r
+             * @param {Grid} this\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'containerclick',\r
+            /**\r
+             * @event containerdblclick\r
+             * Fires when the container is double clicked. The container consists of any part of the grid body that is not covered by a row.\r
+             * @param {Grid} this\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'containerdblclick',\r
+            \r
+            /**\r
+             * @event rowbodyclick\r
+             * Fires when the row body is clicked. <b>Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.</b>\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowbodyclick',\r
+            /**\r
+             * @event rowbodydblclick\r
+             * Fires when the row body is double clicked. <b>Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.</b>\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowbodydblclick',\r
+            \r
             /**\r
              * @event rowcontextmenu\r
              * Fires when a row is right clicked\r
@@ -431,6 +528,30 @@ function(grid, rowIndex, columnIndex, e) {
              * @param {Ext.EventObject} e\r
              */\r
             'headercontextmenu',\r
+            /**\r
+             * @event groupcontextmenu\r
+             * Fires when group header is right clicked. <b>Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}</b>.\r
+             * @param {Grid} this\r
+             * @param {String} groupField\r
+             * @param {String} groupValue\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'groupcontextmenu',\r
+            /**\r
+             * @event containercontextmenu\r
+             * Fires when the container is right clicked. The container consists of any part of the grid body that is not covered by a row.\r
+             * @param {Grid} this\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'containercontextmenu',\r
+            /**\r
+             * @event rowbodycontextmenu\r
+             * Fires when the row body is right clicked. <b>Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured.</b>\r
+             * @param {Grid} this\r
+             * @param {Number} rowIndex\r
+             * @param {Ext.EventObject} e\r
+             */\r
+            'rowbodycontextmenu',\r
             /**\r
              * @event bodyscroll\r
              * Fires when the body element is scrolled\r
@@ -459,6 +580,13 @@ function(grid, rowIndex, columnIndex, e) {
              * @param {Object} sortInfo An object with the keys field and direction\r
              */\r
             'sortchange',\r
+            /**\r
+             * @event groupchange\r
+             * Fires when the grid's grouping changes (only applies for grids with a {@link Ext.grid.GroupingView GroupingView})\r
+             * @param {Grid} this\r
+             * @param {String} groupField A string with the grouping field, null if the store is not grouped.\r
+             */\r
+            'groupchange',\r
             /**\r
              * @event reconfigure\r
              * Fires when the grid is reconfigured with a new store and/or column model.\r
@@ -466,7 +594,13 @@ function(grid, rowIndex, columnIndex, e) {
              * @param {Ext.data.Store} store The new store\r
              * @param {Ext.grid.ColumnModel} colModel The new column model\r
              */\r
-            'reconfigure'\r
+            'reconfigure',\r
+            /**\r
+             * @event viewready\r
+             * Fires when the grid view is available (use this for selecting a default row). \r
+             * @param {Grid} this\r
+             */\r
+            'viewready'\r
         );\r
     },\r
 \r
@@ -474,26 +608,24 @@ function(grid, rowIndex, columnIndex, e) {
     onRender : function(ct, position){\r
         Ext.grid.GridPanel.superclass.onRender.apply(this, arguments);\r
 \r
-        var c = this.body;\r
+        var c = this.getGridEl();\r
 \r
         this.el.addClass('x-grid-panel');\r
 \r
-        var view = this.getView();\r
-        view.init(this);\r
-\r
         this.mon(c, {\r
+            scope: this,\r
             mousedown: this.onMouseDown,\r
             click: this.onClick,\r
             dblclick: this.onDblClick,\r
-            contextmenu: this.onContextMenu,\r
-            keydown: this.onKeyDown,\r
-            scope: this\r
+            contextmenu: this.onContextMenu\r
         });\r
 \r
-        this.relayEvents(c, ['mousedown','mouseup','mouseover','mouseout','keypress']);\r
+        this.relayEvents(c, ['mousedown','mouseup','mouseover','mouseout','keypress', 'keydown']);\r
 \r
+        var view = this.getView();\r
+        view.init(this);\r
+        view.render();\r
         this.getSelectionModel().init(this);\r
-        this.view.render();\r
     },\r
 \r
     // private\r
@@ -512,32 +644,54 @@ function(grid, rowIndex, columnIndex, e) {
     },\r
 \r
     applyState : function(state){\r
-        var cm = this.colModel;\r
-        var cs = state.columns;\r
+        var cm = this.colModel,\r
+            cs = state.columns,\r
+            store = this.store,\r
+            s,\r
+            c,\r
+            oldIndex;\r
+            \r
         if(cs){\r
             for(var i = 0, len = cs.length; i < len; i++){\r
-                var s = cs[i];\r
-                var c = cm.getColumnById(s.id);\r
+                s = cs[i];\r
+                c = cm.getColumnById(s.id);\r
                 if(c){\r
                     c.hidden = s.hidden;\r
                     c.width = s.width;\r
-                    var oldIndex = cm.getIndexById(s.id);\r
+                    oldIndex = cm.getIndexById(s.id);\r
                     if(oldIndex != i){\r
                         cm.moveColumn(oldIndex, i);\r
                     }\r
                 }\r
             }\r
         }\r
-        if(state.sort && this.store){\r
-            this.store[this.store.remoteSort ? 'setDefaultSort' : 'sort'](state.sort.field, state.sort.direction);\r
+        if(store){\r
+            s = state.sort;\r
+            if(s){\r
+                store[store.remoteSort ? 'setDefaultSort' : 'sort'](s.field, s.direction);\r
+            }\r
+            s = state.group;\r
+            if(store.groupBy){\r
+                if(s){\r
+                    store.groupBy(s);\r
+                }else{\r
+                    store.clearGrouping();\r
+                }\r
+            }\r
+\r
         }\r
-        delete state.columns;\r
-        delete state.sort;\r
-        Ext.grid.GridPanel.superclass.applyState.call(this, state);\r
+        var o = Ext.apply({}, state);\r
+        delete o.columns;\r
+        delete o.sort;\r
+        Ext.grid.GridPanel.superclass.applyState.call(this, o);\r
     },\r
 \r
     getState : function(){\r
-        var o = {columns: []};\r
+        var o = {columns: []},\r
+            store = this.store,\r
+            ss,\r
+            gs;\r
+            \r
         for(var i = 0, c; (c = this.colModel.config[i]); i++){\r
             o.columns[i] = {\r
                 id: c.id,\r
@@ -547,11 +701,17 @@ function(grid, rowIndex, columnIndex, e) {
                 o.columns[i].hidden = true;\r
             }\r
         }\r
-        if(this.store){\r
-            var ss = this.store.getSortState();\r
+        if(store){\r
+            ss = store.getSortState();\r
             if(ss){\r
                 o.sort = ss;\r
             }\r
+            if(store.getGroupState){\r
+                gs = store.getGroupState();\r
+                if(gs){\r
+                    o.group = gs;\r
+                }\r
+            }\r
         }\r
         return o;\r
     },\r
@@ -559,11 +719,13 @@ function(grid, rowIndex, columnIndex, e) {
     // private\r
     afterRender : function(){\r
         Ext.grid.GridPanel.superclass.afterRender.call(this);\r
-        this.view.layout();\r
+        var v = this.view;\r
+        this.on('bodyresize', v.layout, v);\r
+        v.layout();\r
         if(this.deferRowRender){\r
-            this.view.afterRender.defer(10, this.view);\r
+            v.afterRender.defer(10, this.view);\r
         }else{\r
-            this.view.afterRender();\r
+            v.afterRender();\r
         }\r
         this.viewReady = true;\r
     },\r
@@ -581,31 +743,28 @@ function(grid, rowIndex, columnIndex, e) {
      * @param {Ext.grid.ColumnModel} colModel The new {@link Ext.grid.ColumnModel} object\r
      */\r
     reconfigure : function(store, colModel){\r
-        if(this.loadMask){\r
-            this.loadMask.destroy();\r
-            this.loadMask = new Ext.LoadMask(this.bwrap,\r
-                    Ext.apply({}, {store:store}, this.initialConfig.loadMask));\r
+        var rendered = this.rendered;\r
+        if(rendered){\r
+            if(this.loadMask){\r
+                this.loadMask.destroy();\r
+                this.loadMask = new Ext.LoadMask(this.bwrap,\r
+                        Ext.apply({}, {store:store}, this.initialConfig.loadMask));\r
+            }\r
+        }\r
+        if(this.view){\r
+            this.view.initData(store, colModel);\r
         }\r
-        this.view.initData(store, colModel);\r
         this.store = store;\r
         this.colModel = colModel;\r
-        if(this.rendered){\r
+        if(rendered){\r
             this.view.refresh(true);\r
         }\r
         this.fireEvent('reconfigure', this, store, colModel);\r
     },\r
 \r
-    // private\r
-    onKeyDown : function(e){\r
-        this.fireEvent('keydown', e);\r
-    },\r
-\r
     // private\r
     onDestroy : function(){\r
         if(this.rendered){\r
-            var c = this.body;\r
-            c.removeAllListeners();\r
-            c.update('');\r
             Ext.destroy(this.view, this.loadMask);\r
         }else if(this.store && this.store.autoDestroy){\r
             this.store.destroy();\r
@@ -618,21 +777,31 @@ function(grid, rowIndex, columnIndex, e) {
     // private\r
     processEvent : function(name, e){\r
         this.fireEvent(name, e);\r
-        var t = e.getTarget();\r
-        var v = this.view;\r
-        var header = v.findHeaderIndex(t);\r
+        var t = e.getTarget(),\r
+            v = this.view,\r
+            header = v.findHeaderIndex(t);\r
+            \r
         if(header !== false){\r
             this.fireEvent('header' + name, this, header, e);\r
         }else{\r
-            var row = v.findRowIndex(t);\r
-            var cell = v.findCellIndex(t);\r
+            var row = v.findRowIndex(t),\r
+                cell,\r
+                body;\r
             if(row !== false){\r
                 this.fireEvent('row' + name, this, row, e);\r
+                cell = v.findCellIndex(t);\r
+                body = v.findRowBody(t);\r
                 if(cell !== false){\r
                     this.fireEvent('cell' + name, this, row, cell, e);\r
                 }\r
+                if(body){\r
+                    this.fireEvent('rowbody' + name, this, row, e);\r
+                }\r
+            }else{\r
+                this.fireEvent('container' + name, this, e);\r
             }\r
         }\r
+        this.view.processEvent(name, e);\r
     },\r
 \r
     // private\r
@@ -657,8 +826,11 @@ function(grid, rowIndex, columnIndex, e) {
 \r
     // private\r
     walkCells : function(row, col, step, fn, scope){\r
-        var cm = this.colModel, clen = cm.getColumnCount();\r
-        var ds = this.store, rlen = ds.getCount(), first = true;\r
+        var cm = this.colModel, \r
+            clen = cm.getColumnCount(),\r
+            ds = this.store, \r
+            rlen = ds.getCount(), \r
+            first = true;\r
         if(step < 0){\r
             if(col < 0){\r
                 row--;\r
@@ -876,7 +1048,7 @@ function(grid, rowIndex, columnIndex, e) {
      * @hide \r
      */\r
     /** \r
-     * @event afterLayout \r
+     * @event afterlayout \r
      * @hide \r
      */\r
     /** \r
@@ -960,67 +1132,7 @@ Ext.reg('grid', Ext.grid.GridPanel);/**
  * @constructor
  * @param {Object} config
  */
-Ext.grid.GridView = function(config){
-    Ext.apply(this, config);
-    // These events are only used internally by the grid components
-    this.addEvents(
-        /**
-         * @event beforerowremoved
-         * Internal UI Event. Fired before a row is removed.
-         * @param {Ext.grid.GridView} view
-         * @param {Number} rowIndex The index of the row to be removed.
-         * @param {Ext.data.Record} record The Record to be removed
-         */
-        "beforerowremoved",
-        /**
-         * @event beforerowsinserted
-         * Internal UI Event. Fired before rows are inserted.
-         * @param {Ext.grid.GridView} view
-         * @param {Number} firstRow The index of the first row to be inserted.
-         * @param {Number} lastRow The index of the last row to be inserted.
-         */
-        "beforerowsinserted",
-        /**
-         * @event beforerefresh
-         * Internal UI Event. Fired before the view is refreshed.
-         * @param {Ext.grid.GridView} view
-         */
-        "beforerefresh",
-        /**
-         * @event rowremoved
-         * Internal UI Event. Fired after a row is removed.
-         * @param {Ext.grid.GridView} view
-         * @param {Number} rowIndex The index of the row that was removed.
-         * @param {Ext.data.Record} record The Record that was removed
-         */
-        "rowremoved",
-        /**
-         * @event rowsinserted
-         * Internal UI Event. Fired after rows are inserted.
-         * @param {Ext.grid.GridView} view
-         * @param {Number} firstRow The index of the first inserted.
-         * @param {Number} lastRow The index of the last row inserted.
-         */
-        "rowsinserted",
-        /**
-         * @event rowupdated
-         * Internal UI Event. Fired after a row has been updated.
-         * @param {Ext.grid.GridView} view
-         * @param {Number} firstRow The index of the row updated.
-         * @param {Ext.data.record} record The Record backing the row updated.
-         */
-        "rowupdated",
-        /**
-         * @event refresh
-         * Internal UI Event. Fired after the GridView's body has been refreshed.
-         * @param {Ext.grid.GridView} view
-         */
-        "refresh"
-    );
-    Ext.grid.GridView.superclass.constructor.call(this);
-};
-
-Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
+Ext.grid.GridView = Ext.extend(Ext.util.Observable, {
     /**
      * Override this function to apply custom CSS classes to rows during rendering.  You can also supply custom
      * parameters to the row template for the current row to customize how it is rendered using the <b>rowParams</b>
@@ -1098,9 +1210,10 @@ viewConfig: {
     deferEmptyText : true,
     /**
      * @cfg {Number} scrollOffset The amount of space to reserve for the vertical scrollbar
-     * (defaults to <tt>19</tt> pixels).
+     * (defaults to <tt>undefined</tt>). If an explicit value isn't specified, this will be automatically
+     * calculated.
      */
-    scrollOffset : 19,
+    scrollOffset : undefined,
     /**
      * @cfg {Boolean} autoFill
      * Defaults to <tt>false</tt>.  Specify <tt>true</tt> to have the column widths re-proportioned
@@ -1121,24 +1234,24 @@ viewConfig: {
      */
     forceFit : false,
     /**
-     * @cfg {Array} sortClasses The CSS classes applied to a header when it is sorted. (defaults to <tt>["sort-asc", "sort-desc"]</tt>)
+     * @cfg {Array} sortClasses The CSS classes applied to a header when it is sorted. (defaults to <tt>['sort-asc', 'sort-desc']</tt>)
      */
-    sortClasses : ["sort-asc", "sort-desc"],
+    sortClasses : ['sort-asc', 'sort-desc'],
     /**
-     * @cfg {String} sortAscText The text displayed in the "Sort Ascending" menu item (defaults to <tt>"Sort Ascending"</tt>)
+     * @cfg {String} sortAscText The text displayed in the 'Sort Ascending' menu item (defaults to <tt>'Sort Ascending'</tt>)
      */
-    sortAscText : "Sort Ascending",
+    sortAscText : 'Sort Ascending',
     /**
-     * @cfg {String} sortDescText The text displayed in the "Sort Descending" menu item (defaults to <tt>"Sort Descending"</tt>)
+     * @cfg {String} sortDescText The text displayed in the 'Sort Descending' menu item (defaults to <tt>'Sort Descending'</tt>)
      */
-    sortDescText : "Sort Descending",
+    sortDescText : 'Sort Descending',
     /**
-     * @cfg {String} columnsText The text displayed in the "Columns" menu item (defaults to <tt>"Columns"</tt>)
+     * @cfg {String} columnsText The text displayed in the 'Columns' menu item (defaults to <tt>'Columns'</tt>)
      */
-    columnsText : "Columns",
+    columnsText : 'Columns',
 
     /**
-     * @cfg {String} selectedRowClass The CSS class applied to a selected row (defaults to <tt>"x-grid3-row-selected"</tt>). An
+     * @cfg {String} selectedRowClass The CSS class applied to a selected row (defaults to <tt>'x-grid3-row-selected'</tt>). An
      * example overriding the default styling:
     <pre><code>
     .x-grid3-row-selected {background-color: yellow;}
@@ -1152,7 +1265,7 @@ viewConfig: {
     </code></pre>
      * @type String
      */
-    selectedRowClass : "x-grid3-row-selected",
+    selectedRowClass : 'x-grid3-row-selected',
 
     // private
     borderWidth : 2,
@@ -1168,6 +1281,11 @@ viewConfig: {
      * @cfg {Number} rowSelectorDepth The number of levels to search for rows in event delegation (defaults to <tt>10</tt>)
      */
     rowSelectorDepth : 10,
+    
+    /**
+     * @cfg {Number} rowBodySelectorDepth The number of levels to search for row bodies in event delegation (defaults to <tt>10</tt>)
+     */
+    rowBodySelectorDepth : 10,
 
     /**
      * @cfg {String} cellSelector The selector used to find cells internally (defaults to <tt>'td.x-grid3-cell'</tt>)
@@ -1178,10 +1296,75 @@ viewConfig: {
      */
     rowSelector : 'div.x-grid3-row',
     
+    /**
+     * @cfg {String} rowBodySelector The selector used to find row bodies internally (defaults to <tt>'div.x-grid3-row'</tt>)
+     */
+    rowBodySelector : 'div.x-grid3-row-body',
+    
     // private
     firstRowCls: 'x-grid3-row-first',
     lastRowCls: 'x-grid3-row-last',
     rowClsRe: /(?:^|\s+)x-grid3-row-(first|last|alt)(?:\s+|$)/g,
+    
+    constructor : function(config){
+        Ext.apply(this, config);
+           // These events are only used internally by the grid components
+           this.addEvents(
+               /**
+                * @event beforerowremoved
+                * Internal UI Event. Fired before a row is removed.
+                * @param {Ext.grid.GridView} view
+                * @param {Number} rowIndex The index of the row to be removed.
+                * @param {Ext.data.Record} record The Record to be removed
+                */
+               'beforerowremoved',
+               /**
+                * @event beforerowsinserted
+                * Internal UI Event. Fired before rows are inserted.
+                * @param {Ext.grid.GridView} view
+                * @param {Number} firstRow The index of the first row to be inserted.
+                * @param {Number} lastRow The index of the last row to be inserted.
+                */
+               'beforerowsinserted',
+               /**
+                * @event beforerefresh
+                * Internal UI Event. Fired before the view is refreshed.
+                * @param {Ext.grid.GridView} view
+                */
+               'beforerefresh',
+               /**
+                * @event rowremoved
+                * Internal UI Event. Fired after a row is removed.
+                * @param {Ext.grid.GridView} view
+                * @param {Number} rowIndex The index of the row that was removed.
+                * @param {Ext.data.Record} record The Record that was removed
+                */
+               'rowremoved',
+               /**
+                * @event rowsinserted
+                * Internal UI Event. Fired after rows are inserted.
+                * @param {Ext.grid.GridView} view
+                * @param {Number} firstRow The index of the first inserted.
+                * @param {Number} lastRow The index of the last row inserted.
+                */
+               'rowsinserted',
+               /**
+                * @event rowupdated
+                * Internal UI Event. Fired after a row has been updated.
+                * @param {Ext.grid.GridView} view
+                * @param {Number} firstRow The index of the row updated.
+                * @param {Ext.data.record} record The Record backing the row updated.
+                */
+               'rowupdated',
+               /**
+                * @event refresh
+                * Internal UI Event. Fired after the GridView's body has been refreshed.
+                * @param {Ext.grid.GridView} view
+                */
+               'refresh'
+           );
+           Ext.grid.GridView.superclass.constructor.call(this);    
+    },
 
     /* -------------------------------- UI Specific ----------------------------- */
 
@@ -1240,14 +1423,14 @@ viewConfig: {
 
         for(var k in ts){
             var t = ts[k];
-            if(t && typeof t.compile == 'function' && !t.compiled){
+            if(t && Ext.isFunction(t.compile) && !t.compiled){
                 t.disableFormats = true;
                 t.compile();
             }
         }
 
         this.templates = ts;
-        this.colRe = new RegExp("x-grid3-td-([^\\s]+)", "");
+        this.colRe = new RegExp('x-grid3-td-([^\\s]+)', '');
     },
 
     // private
@@ -1294,7 +1477,7 @@ viewConfig: {
         this.mainBody = new E(this.scroller.dom.firstChild);
 
         this.focusEl = new E(this.scroller.dom.childNodes[1]);
-        this.focusEl.swallowEvent("click", true);
+        this.focusEl.swallowEvent('click', true);
 
         this.resizeMarker = new E(cs[1]);
         this.resizeProxy = new E(cs[2]);
@@ -1315,12 +1498,12 @@ viewConfig: {
         return this.fly(el).findParent(this.cellSelector, this.cellSelectorDepth);
     },
 
-/**
* <p>Return the index of the grid column which contains the passed element.</p>
- * See also {@link #findRowIndex}
* @param {Element} el The target element
* @return The column index, or <b>false</b> if the target element is not within a row of this GridView.
- */
+    /**
    * <p>Return the index of the grid column which contains the passed HTMLElement.</p>
    * See also {@link #findRowIndex}
    * @param {HTMLElement} el The target element
    * @return {Number} The column index, or <b>false</b> if the target element is not within a row of this GridView.
    */
     findCellIndex : function(el, requiredCls){
         var cell = this.findCell(el);
         if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
@@ -1351,11 +1534,11 @@ viewConfig: {
         return this.findCellIndex(el, this.hdCls);
     },
 
-/**
- * Return the HtmlElement representing the grid row which contains the passed element.
* @param {Element} el The target element
* @return The row element, or null if the target element is not within a row of this GridView.
- */
+    /**
    * Return the HtmlElement representing the grid row which contains the passed element.
    * @param {HTMLElement} el The target HTMLElement
    * @return {HTMLElement} The row element, or null if the target element is not within a row of this GridView.
    */
     findRow : function(el){
         if(!el){
             return false;
@@ -1363,43 +1546,55 @@ viewConfig: {
         return this.fly(el).findParent(this.rowSelector, this.rowSelectorDepth);
     },
 
-/**
* <p>Return the index of the grid row which contains the passed element.</p>
- * See also {@link #findCellIndex}
* @param {Element} el The target element
* @return The row index, or <b>false</b> if the target element is not within a row of this GridView.
- */
+    /**
    * <p>Return the index of the grid row which contains the passed HTMLElement.</p>
    * See also {@link #findCellIndex}
    * @param {HTMLElement} el The target HTMLElement
    * @return {Number} The row index, or <b>false</b> if the target element is not within a row of this GridView.
    */
     findRowIndex : function(el){
         var r = this.findRow(el);
         return r ? r.rowIndex : false;
     },
+    
+    /**
+     * Return the HtmlElement representing the grid row body which contains the passed element.
+     * @param {HTMLElement} el The target HTMLElement
+     * @return {HTMLElement} The row body element, or null if the target element is not within a row body of this GridView.
+     */
+    findRowBody : function(el){
+        if(!el){
+            return false;
+        }
+        return this.fly(el).findParent(this.rowBodySelector, this.rowBodySelectorDepth);
+    },
 
     // getter methods for fetching elements dynamically in the grid
 
-/**
- * Return the <tt>&lt;div></tt> HtmlElement which represents a Grid row for the specified index.
- * @param {Number} index The row index
- * @return {HtmlElement} The div element.
- */
+    /**
    * Return the <tt>&lt;div></tt> HtmlElement which represents a Grid row for the specified index.
    * @param {Number} index The row index
    * @return {HtmlElement} The div element.
    */
     getRow : function(row){
         return this.getRows()[row];
     },
 
-/**
- * Returns the grid's <tt>&lt;td></tt> HtmlElement at the specified coordinates.
- * @param {Number} row The row index in which to find the cell.
- * @param {Number} col The column index of the cell.
- * @return {HtmlElement} The td at the specified coordinates.
- */
+    /**
    * Returns the grid's <tt>&lt;td></tt> HtmlElement at the specified coordinates.
    * @param {Number} row The row index in which to find the cell.
    * @param {Number} col The column index of the cell.
    * @return {HtmlElement} The td at the specified coordinates.
    */
     getCell : function(row, col){
         return this.getRow(row).getElementsByTagName('td')[col];
     },
 
-/**
- * Return the <tt>&lt;td></tt> HtmlElement which represents the Grid's header cell for the specified column index.
- * @param {Number} index The column index
- * @return {HtmlElement} The td element.
- */
+    /**
    * Return the <tt>&lt;td></tt> HtmlElement which represents the Grid's header cell for the specified column index.
    * @param {Number} index The column index
    * @return {HtmlElement} The td element.
    */
     getHeaderCell : function(index){
       return this.mainHd.dom.getElementsByTagName('td')[index];
     },
@@ -1464,7 +1659,7 @@ viewConfig: {
     syncScroll : function(){
       this.syncHeaderScroll();
       var mb = this.scroller.dom;
-        this.grid.fireEvent("bodyscroll", mb.scrollLeft, mb.scrollTop);
+        this.grid.fireEvent('bodyscroll', mb.scrollLeft, mb.scrollTop);
     },
 
     // private
@@ -1478,7 +1673,7 @@ viewConfig: {
     updateSortIcon : function(col, dir){
         var sc = this.sortClasses;
         var hds = this.mainHd.select('td').removeClass(sc);
-        hds.item(col).addClass(sc[dir == "DESC" ? 1 : 0]);
+        hds.item(col).addClass(sc[dir == 'DESC' ? 1 : 0]);
     },
 
     // private
@@ -1577,33 +1772,33 @@ viewConfig: {
                 c = cs[i];
                 p.id = c.id;
                 p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
-                p.attr = p.cellAttr = "";
-                p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
+                p.attr = p.cellAttr = '';
+                p.value = c.renderer.call(c.scope, r.data[c.name], p, r, rowIndex, i, ds);
                 p.style = c.style;
                 if(Ext.isEmpty(p.value)){
-                    p.value = "&#160;";
+                    p.value = '&#160;';
                 }
-                if(this.markDirty && r.dirty && typeof r.modified[c.name] !== 'undefined'){
+                if(this.markDirty && r.dirty && Ext.isDefined(r.modified[c.name])){
                     p.css += ' x-grid3-dirty-cell';
                 }
                 cb[cb.length] = ct.apply(p);
             }
             var alt = [];
             if(stripe && ((rowIndex+1) % 2 === 0)){
-                alt[0] = "x-grid3-row-alt";
+                alt[0] = 'x-grid3-row-alt';
             }
             if(r.dirty){
-                alt[1] = " x-grid3-dirty-row";
+                alt[1] = ' x-grid3-dirty-row';
             }
             rp.cols = colCount;
             if(this.getRowClass){
                 alt[2] = this.getRowClass(r, rowIndex, rp, ds);
             }
-            rp.alt = alt.join(" ");
-            rp.cells = cb.join("");
+            rp.alt = alt.join(' ');
+            rp.cells = cb.join('');
             buf[buf.length] =  rt.apply(rp);
         }
-        return buf.join("");
+        return buf.join('');
     },
 
     // private
@@ -1611,16 +1806,24 @@ viewConfig: {
         if(!this.ds || this.ds.getCount() < 1){
             return;
         }
-        var rows = this.getRows();
+        var rows = this.getRows(),
+            len = rows.length,
+            i, r;
+            
         skipStripe = skipStripe || !this.grid.stripeRows;
         startRow = startRow || 0;
-        Ext.each(rows, function(row, idx){
-            row.rowIndex = idx;
-            row.className = row.className.replace(this.rowClsRe, ' ');
-            if (!skipStripe && (idx + 1) % 2 === 0) {
-                row.className += ' x-grid3-row-alt';
-            }
-        });
+        for(i = 0; i<len; i++) {
+            r = rows[i];
+            if(r) {
+                r.rowIndex = i;
+                if(!skipStripe){
+                    r.className = r.className.replace(this.rowClsRe, ' ');
+                    if ((i + 1) % 2 === 0){
+                        r.className += ' x-grid3-row-alt';
+                    }
+                }   
+            }          
+        }
         // add first/last-row classes
         if(startRow === 0){
             Ext.fly(rows[0]).addClass(this.firstRowCls);
@@ -1638,6 +1841,7 @@ viewConfig: {
         if(this.deferEmptyText !== true){
             this.applyEmptyText();
         }
+        this.grid.fireEvent('viewready', this.grid);
     },
 
     // private
@@ -1661,7 +1865,7 @@ viewConfig: {
         this.initElements();
 
         // get mousedowns early
-        Ext.fly(this.innerHd).on("click", this.handleHdDown, this);
+        Ext.fly(this.innerHd).on('click', this.handleHdDown, this);
         this.mainHd.on({
             scope: this,
             mouseover: this.handleHdOver,
@@ -1680,27 +1884,27 @@ viewConfig: {
         }
 
         if(g.enableHdMenu !== false){
-            this.hmenu = new Ext.menu.Menu({id: g.id + "-hctx"});
+            this.hmenu = new Ext.menu.Menu({id: g.id + '-hctx'});
             this.hmenu.add(
-                {itemId:"asc", text: this.sortAscText, cls: "xg-hmenu-sort-asc"},
-                {itemId:"desc", text: this.sortDescText, cls: "xg-hmenu-sort-desc"}
+                {itemId:'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'},
+                {itemId:'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'}
             );
             if(g.enableColumnHide !== false){
-                this.colMenu = new Ext.menu.Menu({id:g.id + "-hcols-menu"});
+                this.colMenu = new Ext.menu.Menu({id:g.id + '-hcols-menu'});
                 this.colMenu.on({
                     scope: this,
                     beforeshow: this.beforeColMenuShow,
                     itemclick: this.handleHdMenuClick
                 });
                 this.hmenu.add('-', {
-                    itemId:"columns",
+                    itemId:'columns',
                     hideOnClick: false,
                     text: this.columnsText,
                     menu: this.colMenu,
                     iconCls: 'x-cols-icon'
                 });
             }
-            this.hmenu.on("itemclick", this.handleHdMenuClick, this);
+            this.hmenu.on('itemclick', this.handleHdMenuClick, this);
         }
 
         if(g.trackMouseOver){
@@ -1720,6 +1924,9 @@ viewConfig: {
         this.updateHeaderSortState();
 
     },
+    
+    // private
+    processEvent: Ext.emptyFn,
 
     // private
     layout : function(){
@@ -1806,7 +2013,11 @@ viewConfig: {
     
     // private 
     getOffsetWidth : function() {
-        return (this.cm.getTotalWidth() + this.scrollOffset) + 'px';
+        return (this.cm.getTotalWidth() + this.getScrollOffset()) + 'px';
+    },
+    
+    getScrollOffset: function(){
+        return Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
     },
 
     // private
@@ -1821,7 +2032,7 @@ viewConfig: {
             
         for(var i = 0; i < len; i++){
             p.id = cm.getColumnId(i);
-            p.value = cm.getColumnHeader(i) || "";
+            p.value = cm.getColumnHeader(i) || '';
             p.style = this.getColumnStyle(i, true);
             p.tooltip = this.getColumnTooltip(i);
             p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
@@ -1832,7 +2043,7 @@ viewConfig: {
             }
             cb[cb.length] = ct.apply(p);
         }
-        return ts.header.apply({cells: cb.join(""), tstyle:'width:'+this.getTotalWidth()+';'});
+        return ts.header.apply({cells: cb.join(''), tstyle:'width:'+this.getTotalWidth()+';'});
     },
 
     // private
@@ -1845,7 +2056,7 @@ viewConfig: {
                 return 'title="'+tt+'"';
             }
         }
-        return "";
+        return '';
     },
 
     // private
@@ -1883,7 +2094,7 @@ viewConfig: {
     },
 
     resolveCell : function(row, col, hscroll){
-        if(typeof row != "number"){
+        if(!Ext.isNumber(row)){
             row = row.rowIndex;
         }
         if(!this.ds){
@@ -1942,13 +2153,13 @@ viewConfig: {
             ctop += p.offsetTop;
             p = p.offsetParent;
         }
+        
         ctop -= this.mainHd.dom.offsetHeight;
-
+        stop = parseInt(c.scrollTop, 10);
+        
         var cbot = ctop + rowEl.offsetHeight,
             ch = c.clientHeight,
             sbot = stop + ch;
-            
-        stop = parseInt(c.scrollTop, 10);
         
 
         if(ctop < stop){
@@ -1976,10 +2187,12 @@ viewConfig: {
     insertRows : function(dm, firstRow, lastRow, isUpdate){
         var last = dm.getCount() - 1;
         if(!isUpdate && firstRow === 0 && lastRow >= last){
+           this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
             this.refresh();
+           this.fireEvent('rowsinserted', this, firstRow, lastRow);
         }else{
             if(!isUpdate){
-                this.fireEvent("beforerowsinserted", this, firstRow, lastRow);
+                this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
             }
             var html = this.renderRows(firstRow, lastRow),
                 before = this.getRow(firstRow);
@@ -1996,7 +2209,7 @@ viewConfig: {
                 Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
             }
             if(!isUpdate){
-                this.fireEvent("rowsinserted", this, firstRow, lastRow);
+                this.fireEvent('rowsinserted', this, firstRow, lastRow);
                 this.processRows(firstRow);
             }else if(firstRow === 0 || firstRow >= last){
                 //ensure first/last row is kept after an update.
@@ -2011,12 +2224,12 @@ viewConfig: {
         if(dm.getRowCount()<1){
             this.refresh();
         }else{
-            this.fireEvent("beforerowsdeleted", this, firstRow, lastRow);
+            this.fireEvent('beforerowsdeleted', this, firstRow, lastRow);
 
             this.removeRows(firstRow, lastRow);
 
             this.processRows(firstRow);
-            this.fireEvent("rowsdeleted", this, firstRow, lastRow);
+            this.fireEvent('rowsdeleted', this, firstRow, lastRow);
         }
     },
 
@@ -2037,8 +2250,8 @@ viewConfig: {
     // private
     getColumnWidth : function(col){
         var w = this.cm.getColumnWidth(col);
-        if(typeof w == 'number'){
-            return (Ext.isBorderBox ? w : (w-this.borderWidth > 0 ? w-this.borderWidth:0)) + 'px';
+        if(Ext.isNumber(w)){
+            return (Ext.isBorderBox || (Ext.isWebKit && !Ext.isSafari2) ? w : (w - this.borderWidth > 0 ? w - this.borderWidth : 0)) + 'px';
         }
         return w;
     },
@@ -2052,7 +2265,7 @@ viewConfig: {
     fitColumns : function(preventRefresh, onlyExpand, omitColumn){
         var cm = this.cm, i;
         var tw = cm.getTotalWidth(false);
-        var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
+        var aw = this.grid.getGridEl().getWidth(true)-this.getScrollOffset();
 
         if(aw < 20){ // not initialized, so don't screw up the default widths
             return;
@@ -2064,7 +2277,7 @@ viewConfig: {
         }
 
         var vc = cm.getColumnCount(true);
-        var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
+        var ac = vc-(Ext.isNumber(omitColumn) ? 1 : 0);
         if(ac === 0){
             ac = 1;
             omitColumn = undefined;
@@ -2109,7 +2322,7 @@ viewConfig: {
         var g = this.grid, cm = this.cm;
         if(!this.userResized && g.autoExpandColumn){
             var tw = cm.getTotalWidth(false);
-            var aw = this.grid.getGridEl().getWidth(true)-this.scrollOffset;
+            var aw = this.grid.getGridEl().getWidth(true)-this.getScrollOffset();
             if(tw != aw){
                 var ci = cm.getIndexById(g.autoExpandColumn);
                 var currentWidth = cm.getColumnWidth(ci);
@@ -2131,8 +2344,9 @@ viewConfig: {
         for(var i = 0; i < colCount; i++){
             var name = cm.getDataIndex(i);
             cs[i] = {
-                name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
+                name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
                 renderer : cm.getRenderer(i),
+                scope: cm.getRendererScope(i),
                 id : cm.getColumnId(i),
                 style : this.getColumnStyle(i)
             };
@@ -2147,13 +2361,13 @@ viewConfig: {
         var colCount = cm.getColumnCount();
 
         if(ds.getCount() < 1){
-            return "";
+            return '';
         }
 
         var cs = this.getColumnData();
 
         startRow = startRow || 0;
-        endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
+        endRow = !Ext.isDefined(endRow) ? ds.getCount()-1 : endRow;
 
         // records to render
         var rs = ds.getRange(startRow, endRow);
@@ -2170,7 +2384,7 @@ viewConfig: {
     // private
     refreshRow : function(record){
         var ds = this.ds, index;
-        if(typeof record == 'number'){
+        if(Ext.isNumber(record)){
             index = record;
             record = ds.getAt(index);
             if(!record){
@@ -2185,7 +2399,7 @@ viewConfig: {
         this.insertRows(ds, index, index, true);
         this.getRow(index).rowIndex = index;
         this.onRemove(ds, record, index+1, true);
-        this.fireEvent("rowupdated", this, index, record);
+        this.fireEvent('rowupdated', this, index, record);
     },
 
     /**
@@ -2193,7 +2407,7 @@ viewConfig: {
      * @param {Boolean} headersToo (optional) True to also refresh the headers
      */
     refresh : function(headersToo){
-        this.fireEvent("beforerefresh", this);
+        this.fireEvent('beforerefresh', this);
         this.grid.stopEditing(true);
 
         var result = this.renderBody();
@@ -2205,7 +2419,7 @@ viewConfig: {
         this.processRows(0, true);
         this.layout();
         this.applyEmptyText();
-        this.fireEvent("refresh", this);
+        this.fireEvent('refresh', this);
     },
 
     // private
@@ -2232,6 +2446,16 @@ viewConfig: {
         }
     },
 
+    // private
+    clearHeaderSortState : function(){
+        if(!this.sortState){
+            return;
+        }
+        this.grid.fireEvent('sortchange', this.grid, null);
+        this.mainHd.select('td').removeClass(this.sortClasses);
+        delete this.sortState;
+    },
+
     // private
     destroy : function(){
         if(this.colMenu){
@@ -2244,41 +2468,75 @@ viewConfig: {
             this.hmenu.destroy();
             delete this.hmenu;
         }
+
+        this.initData(null, null);
+        this.purgeListeners();
+        Ext.fly(this.innerHd).un("click", this.handleHdDown, this);
+
         if(this.grid.enableColumnMove){
-            var dds = Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
-            if(dds){
-                for(var dd in dds){
-                    if(!dds[dd].config.isTarget && dds[dd].dragElId){
-                        var elid = dds[dd].dragElId;
-                        dds[dd].unreg();
-                        Ext.get(elid).remove();
-                    } else if(dds[dd].config.isTarget){
-                        dds[dd].proxyTop.remove();
-                        dds[dd].proxyBottom.remove();
-                        dds[dd].unreg();
-                    }
-                    if(Ext.dd.DDM.locationCache[dd]){
-                        delete Ext.dd.DDM.locationCache[dd];
-                    }
-                }
-                delete Ext.dd.DDM.ids['gridHeader' + this.grid.getGridEl().id];
+            Ext.destroy(
+                this.columnDrag.el,
+                this.columnDrag.proxy.ghost,
+                this.columnDrag.proxy.el,
+                this.columnDrop.el,
+                this.columnDrop.proxyTop,
+                this.columnDrop.proxyBottom,
+                this.columnDrag.dragData.ddel,
+                this.columnDrag.dragData.header
+            );
+            if (this.columnDrag.proxy.anim) {
+                Ext.destroy(this.columnDrag.proxy.anim);
             }
+            delete this.columnDrag.proxy.ghost;
+            delete this.columnDrag.dragData.ddel;
+            delete this.columnDrag.dragData.header;
+            this.columnDrag.destroy();
+            delete Ext.dd.DDM.locationCache[this.columnDrag.id];
+            delete this.columnDrag._domRef;
+
+            delete this.columnDrop.proxyTop;
+            delete this.columnDrop.proxyBottom;
+            this.columnDrop.destroy();
+            delete Ext.dd.DDM.locationCache["gridHeader" + this.grid.getGridEl().id];
+            delete this.columnDrop._domRef;
+            delete Ext.dd.DDM.ids[this.columnDrop.ddGroup];
         }
 
-        if(this.dragZone){
-            this.dragZone.unreg();
+        if (this.splitZone){ // enableColumnResize
+            this.splitZone.destroy();
+            delete this.splitZone._domRef;
+            delete Ext.dd.DDM.ids["gridSplitters" + this.grid.getGridEl().id];
         }
-        
+
         Ext.fly(this.innerHd).removeAllListeners();
         Ext.removeNode(this.innerHd);
-        
-        Ext.destroy(this.resizeMarker, this.resizeProxy, this.focusEl, this.mainBody, 
-                    this.scroller, this.mainHd, this.mainWrap, this.dragZone, 
-                    this.splitZone, this.columnDrag, this.columnDrop);
+        delete this.innerHd;
+
+        Ext.destroy(
+            this.el,
+            this.mainWrap,
+            this.mainHd,
+            this.scroller,
+            this.mainBody,
+            this.focusEl,
+            this.resizeMarker,
+            this.resizeProxy,
+            this.activeHdBtn,
+            this.dragZone,
+            this.splitZone,
+            this._flyweight
+        );
+
+        delete this.grid.container;
+
+        if(this.dragZone){
+            this.dragZone.destroy();
+        }
+
+        Ext.dd.DDM.currentTarget = null;
+        delete Ext.dd.DDM.locationCache[this.grid.getGridEl().id];
 
-        this.initData(null, null);
         Ext.EventManager.removeResizeListener(this.onWindowResize, this);
-        this.purgeListeners();
     },
 
     // private
@@ -2311,12 +2569,12 @@ viewConfig: {
     // private
     initData : function(ds, cm){
         if(this.ds){
-            this.ds.un("load", this.onLoad, this);
-            this.ds.un("datachanged", this.onDataChange, this);
-            this.ds.un("add", this.onAdd, this);
-            this.ds.un("remove", this.onRemove, this);
-            this.ds.un("update", this.onUpdate, this);
-            this.ds.un("clear", this.onClear, this);
+            this.ds.un('load', this.onLoad, this);
+            this.ds.un('datachanged', this.onDataChange, this);
+            this.ds.un('add', this.onAdd, this);
+            this.ds.un('remove', this.onRemove, this);
+            this.ds.un('update', this.onUpdate, this);
+            this.ds.un('clear', this.onClear, this);
             if(this.ds !== ds && this.ds.autoDestroy){
                 this.ds.destroy();
             }
@@ -2335,11 +2593,11 @@ viewConfig: {
         this.ds = ds;
 
         if(this.cm){
-            this.cm.un("configchange", this.onColConfigChange, this);
-            this.cm.un("widthchange", this.onColWidthChange, this);
-            this.cm.un("headerchange", this.onHeaderChange, this);
-            this.cm.un("hiddenchange", this.onHiddenChange, this);
-            this.cm.un("columnmoved", this.onColumnMove, this);
+            this.cm.un('configchange', this.onColConfigChange, this);
+            this.cm.un('widthchange', this.onColWidthChange, this);
+            this.cm.un('headerchange', this.onHeaderChange, this);
+            this.cm.un('hiddenchange', this.onHiddenChange, this);
+            this.cm.un('columnmoved', this.onColumnMove, this);
         }
         if(cm){
             delete this.lastViewWidth;
@@ -2375,25 +2633,26 @@ viewConfig: {
 
     // private
     onAdd : function(ds, records, index){
+       
         this.insertRows(ds, index, index + (records.length-1));
     },
 
     // private
     onRemove : function(ds, record, index, isUpdate){
         if(isUpdate !== true){
-            this.fireEvent("beforerowremoved", this, index, record);
+            this.fireEvent('beforerowremoved', this, index, record);
         }
         this.removeRow(index);
         if(isUpdate !== true){
             this.processRows(index);
             this.applyEmptyText();
-            this.fireEvent("rowremoved", this, index, record);
+            this.fireEvent('rowremoved', this, index, record);
         }
     },
 
     // private
     onLoad : function(){
-        this.scrollToTop();
+        this.scrollToTop.defer(Ext.isGecko ? 1 : 0, this);
     },
 
     // private
@@ -2431,7 +2690,7 @@ viewConfig: {
     /* -------------------- UI Events and Handlers ------------------------------ */
     // private
     initUI : function(grid){
-        grid.on("headerclick", this.onHeaderClick, this);
+        grid.on('headerclick', this.onHeaderClick, this);
     },
 
     // private
@@ -2451,7 +2710,7 @@ viewConfig: {
     onRowOver : function(e, t){
         var row;
         if((row = this.findRowIndex(t)) !== false){
-            this.addRowClass(row, "x-grid3-row-over");
+            this.addRowClass(row, 'x-grid3-row-over');
         }
     },
 
@@ -2459,7 +2718,7 @@ viewConfig: {
     onRowOut : function(e, t){
         var row;
         if((row = this.findRowIndex(t)) !== false && !e.within(this.getRow(row), true)){
-            this.removeRowClass(row, "x-grid3-row-over");
+            this.removeRowClass(row, 'x-grid3-row-over');
         }
     },
 
@@ -2482,7 +2741,7 @@ viewConfig: {
     onCellSelect : function(row, col){
         var cell = this.getCell(row, col);
         if(cell){
-            this.fly(cell).addClass("x-grid3-cell-selected");
+            this.fly(cell).addClass('x-grid3-cell-selected');
         }
     },
 
@@ -2490,7 +2749,7 @@ viewConfig: {
     onCellDeselect : function(row, col){
         var cell = this.getCell(row, col);
         if(cell){
-            this.fly(cell).removeClass("x-grid3-cell-selected");
+            this.fly(cell).removeClass('x-grid3-cell-selected');
         }
     },
 
@@ -2508,22 +2767,24 @@ viewConfig: {
             this.syncHeaderScroll();
         }
 
-        this.grid.fireEvent("columnresize", i, w);
+        this.grid.fireEvent('columnresize', i, w);
     },
 
     // private
     handleHdMenuClick : function(item){
-        var index = this.hdCtxIndex;
-        var cm = this.cm, ds = this.ds;
-        switch(item.itemId){
-            case "asc":
-                ds.sort(cm.getDataIndex(index), "ASC");
+        var index = this.hdCtxIndex,
+            cm = this.cm, 
+            ds = this.ds,
+            id = item.getItemId();
+        switch(id){
+            case 'asc':
+                ds.sort(cm.getDataIndex(index), 'ASC');
                 break;
-            case "desc":
-                ds.sort(cm.getDataIndex(index), "DESC");
+            case 'desc':
+                ds.sort(cm.getDataIndex(index), 'DESC');
                 break;
             default:
-                index = cm.getIndexById(item.itemId.substr(4));
+                index = cm.getIndexById(id.substr(4));
                 if(index != -1){
                     if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
                         this.onDenyColumnHide();
@@ -2547,7 +2808,7 @@ viewConfig: {
         for(var i = 0; i < colCount; i++){
             if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
                 this.colMenu.add(new Ext.menu.CheckItem({
-                    itemId: "col-"+cm.getColumnId(i),
+                    itemId: 'col-'+cm.getColumnId(i),
                     text: cm.getColumnHeader(i),
                     checked: !cm.isHidden(i),
                     hideOnClick:false,
@@ -2566,12 +2827,12 @@ viewConfig: {
             var index = this.getCellIndex(hd);
             this.hdCtxIndex = index;
             var ms = this.hmenu.items, cm = this.cm;
-            ms.get("asc").setDisabled(!cm.isSortable(index));
-            ms.get("desc").setDisabled(!cm.isSortable(index));
-            this.hmenu.on("hide", function(){
+            ms.get('asc').setDisabled(!cm.isSortable(index));
+            ms.get('desc').setDisabled(!cm.isSortable(index));
+            this.hmenu.on('hide', function(){
                 Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
             }, this, {single:true});
-            this.hmenu.show(t, "tl-bl?");
+            this.hmenu.show(t, 'tl-bl?');
         }
     },
 
@@ -2579,12 +2840,12 @@ viewConfig: {
     handleHdOver : function(e, t){
         var hd = this.findHeaderCell(t);
         if(hd && !this.headersDisabled){
-            this.activeHd = hd;
+            this.activeHdRef = t;
             this.activeHdIndex = this.getCellIndex(hd);
             var fly = this.fly(hd);
             this.activeHdRegion = fly.getRegion();
             if(!this.cm.isMenuDisabled(this.activeHdIndex)){
-                fly.addClass("x-grid3-hd-over");
+                fly.addClass('x-grid3-hd-over');
                 this.activeHdBtn = fly.child('.x-grid3-hd-btn');
                 if(this.activeHdBtn){
                     this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
@@ -2595,18 +2856,21 @@ viewConfig: {
 
     // private
     handleHdMove : function(e, t){
-        if(this.activeHd && !this.headersDisabled){
-            var hw = this.splitHandleWidth || 5;
-            var r = this.activeHdRegion;
-            var x = e.getPageX();
-            var ss = this.activeHd.style;
-            if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
-                ss.cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize not always supported
-            }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
-                ss.cursor = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
-            }else{
-                ss.cursor = '';
+        var hd = this.findHeaderCell(this.activeHdRef);
+        if(hd && !this.headersDisabled){
+            var hw = this.splitHandleWidth || 5,
+                r = this.activeHdRegion,
+                x = e.getPageX(),
+                ss = hd.style,
+                cur = '';
+            if(this.grid.enableColumnResize !== false){
+                if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
+                    cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize not always supported
+                }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
+                    cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
+                }
             }
+            ss.cursor = cur;
         }
     },
 
@@ -2614,8 +2878,8 @@ viewConfig: {
     handleHdOut : function(e, t){
         var hd = this.findHeaderCell(t);
         if(hd && (!Ext.isIE || !e.within(hd, true))){
-            this.activeHd = null;
-            this.fly(hd).removeClass("x-grid3-hd-over");
+            this.activeHdRef = null;
+            this.fly(hd).removeClass('x-grid3-hd-over');
             hd.style.cursor = '';
         }
     },
@@ -2641,7 +2905,7 @@ Ext.grid.GridView.SplitDragZone = function(grid, hd){
     this.marker = this.view.resizeMarker;
     this.proxy = this.view.resizeProxy;
     Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
-        "gridSplitters" + this.grid.getGridEl().id, {
+        'gridSplitters' + this.grid.getGridEl().id, {
         dragElId : Ext.id(this.proxy.dom), resizeFrame:false
     });
     this.scroll = false;
@@ -2666,11 +2930,15 @@ Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
         this.startPos = x;
         Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
     },
+    
+    allowHeaderDrag : function(e){
+        return true;
+    },
 
 
     handleMouseDown : function(e){
         var t = this.view.findHeaderCell(e.getTarget());
-        if(t){
+        if(t && this.allowHeaderDrag(e)){
             var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
             var exy = e.getXY(), ex = exy[0];
             var w = t.offsetWidth, adjust = false;
@@ -2721,19 +2989,21 @@ Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
 });
 // private\r
 // This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDragZone = function(grid, hd, hd2){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
-    Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);\r
-    if(hd2){\r
-        this.setHandleElId(Ext.id(hd));\r
-        this.setOuterHandleElId(Ext.id(hd2));\r
-    }\r
-    this.scroll = false;\r
-};\r
-Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {\r
+Ext.grid.HeaderDragZone = Ext.extend(Ext.dd.DragZone, {\r
     maxDragWidth: 120,\r
+    \r
+    constructor : function(grid, hd, hd2){\r
+        this.grid = grid;\r
+        this.view = grid.getView();\r
+        this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
+        Ext.grid.HeaderDragZone.superclass.constructor.call(this, hd);\r
+        if(hd2){\r
+            this.setHandleElId(Ext.id(hd));\r
+            this.setOuterHandleElId(Ext.id(hd2));\r
+        }\r
+        this.scroll = false;\r
+    },\r
+    \r
     getDragData : function(e){\r
         var t = Ext.lib.Event.getTarget(e);\r
         var h = this.view.findHeaderCell(t);\r
@@ -2769,28 +3039,29 @@ Ext.extend(Ext.grid.HeaderDragZone, Ext.dd.DragZone, {
 \r
 // private\r
 // This is a support class used internally by the Grid components\r
-Ext.grid.HeaderDropZone = function(grid, hd, hd2){\r
-    this.grid = grid;\r
-    this.view = grid.getView();\r
-    // split the proxies so they don't interfere with mouse events\r
-    this.proxyTop = Ext.DomHelper.append(document.body, {\r
-        cls:"col-move-top", html:"&#160;"\r
-    }, true);\r
-    this.proxyBottom = Ext.DomHelper.append(document.body, {\r
-        cls:"col-move-bottom", html:"&#160;"\r
-    }, true);\r
-    this.proxyTop.hide = this.proxyBottom.hide = function(){\r
-        this.setLeftTop(-100,-100);\r
-        this.setStyle("visibility", "hidden");\r
-    };\r
-    this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
-    // temporarily disabled\r
-    //Ext.dd.ScrollManager.register(this.view.scroller.dom);\r
-    Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);\r
-};\r
-Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {\r
+Ext.grid.HeaderDropZone = Ext.extend(Ext.dd.DropZone, {\r
     proxyOffsets : [-4, -9],\r
     fly: Ext.Element.fly,\r
+    \r
+    constructor : function(grid, hd, hd2){\r
+        this.grid = grid;\r
+        this.view = grid.getView();\r
+        // split the proxies so they don't interfere with mouse events\r
+        this.proxyTop = Ext.DomHelper.append(document.body, {\r
+            cls:"col-move-top", html:"&#160;"\r
+        }, true);\r
+        this.proxyBottom = Ext.DomHelper.append(document.body, {\r
+            cls:"col-move-bottom", html:"&#160;"\r
+        }, true);\r
+        this.proxyTop.hide = this.proxyBottom.hide = function(){\r
+            this.setLeftTop(-100,-100);\r
+            this.setStyle("visibility", "hidden");\r
+        };\r
+        this.ddGroup = "gridHeader" + this.grid.getGridEl().id;\r
+        // temporarily disabled\r
+        //Ext.dd.ScrollManager.register(this.view.scroller.dom);\r
+        Ext.grid.HeaderDropZone.superclass.constructor.call(this, grid.getGridEl().dom);\r
+    },\r
 \r
     getTargetFromEvent : function(e){\r
         var t = Ext.lib.Event.getTarget(e);\r
@@ -2890,22 +3161,20 @@ Ext.extend(Ext.grid.HeaderDropZone, Ext.dd.DropZone, {
                 newIndex--;\r
             }\r
             cm.moveColumn(oldIndex, newIndex);\r
-            this.grid.fireEvent("columnmove", oldIndex, newIndex);\r
             return true;\r
         }\r
         return false;\r
     }\r
 });\r
 \r
-\r
-Ext.grid.GridView.ColumnDragZone = function(grid, hd){\r
-    Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);\r
-    this.proxy.el.addClass('x-grid3-col-dd');\r
-};\r
-\r
-Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {\r
+Ext.grid.GridView.ColumnDragZone = Ext.extend(Ext.grid.HeaderDragZone, {\r
+    \r
+    constructor : function(grid, hd){\r
+        Ext.grid.GridView.ColumnDragZone.superclass.constructor.call(this, grid, hd, null);\r
+        this.proxy.el.addClass('x-grid3-col-dd');\r
+    },\r
+    \r
     handleMouseDown : function(e){\r
-\r
     },\r
 \r
     callHandleMouseDown : function(e){\r
@@ -2913,20 +3182,21 @@ Ext.extend(Ext.grid.GridView.ColumnDragZone, Ext.grid.HeaderDragZone, {
     }\r
 });// private
 // This is a support class used internally by the Grid components
-Ext.grid.SplitDragZone = function(grid, hd, hd2){
-    this.grid = grid;
-    this.view = grid.getView();
-    this.proxy = this.view.resizeProxy;
-    Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
-        "gridSplitters" + this.grid.getGridEl().id, {
-        dragElId : Ext.id(this.proxy.dom), resizeFrame:false
-    });
-    this.setHandleElId(Ext.id(hd));
-    this.setOuterHandleElId(Ext.id(hd2));
-    this.scroll = false;
-};
-Ext.extend(Ext.grid.SplitDragZone, Ext.dd.DDProxy, {
+Ext.grid.SplitDragZone = Ext.extend(Ext.dd.DDProxy, {
     fly: Ext.Element.fly,
+    
+    constructor : function(grid, hd, hd2){
+        this.grid = grid;
+        this.view = grid.getView();
+        this.proxy = this.view.resizeProxy;
+        Ext.grid.SplitDragZone.superclass.constructor.call(this, hd,
+            "gridSplitters" + this.grid.getGridEl().id, {
+            dragElId : Ext.id(this.proxy.dom), resizeFrame:false
+        });
+        this.setHandleElId(Ext.id(hd));
+        this.setOuterHandleElId(Ext.id(hd2));
+        this.scroll = false;
+    },
 
     b4StartDrag : function(x, y){
         this.view.headersDisabled = true;
@@ -3086,7 +3356,7 @@ Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
  * {@link Ext.grid.Column} column configuration object within the specified Array defines the initial
  * order of the column display.  A Column's display may be initially hidden using the
  * <tt>{@link Ext.grid.Column#hidden hidden}</tt></b> config property (and then shown using the column
- * header menu).  Field's that are not included in the ColumnModel will not be displayable at all.</p>
+ * header menu).  Fields that are not included in the ColumnModel will not be displayable at all.</p>
  * <p>How each column in the grid correlates (maps) to the {@link Ext.data.Record} field in the
  * {@link Ext.data.Store Store} the column draws its data from is configured through the
  * <b><tt>{@link Ext.grid.Column#dataIndex dataIndex}</tt></b>.  If the
@@ -3139,66 +3409,7 @@ Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
  * @param {Mixed} config Specify either an Array of {@link Ext.grid.Column} configuration objects or specify
  * a configuration Object (see introductory section discussion utilizing Initialization Method 2 above).
  */
-Ext.grid.ColumnModel = function(config){
-    /**
-     * An Array of {@link Ext.grid.Column Column definition} objects representing the configuration
-     * of this ColumnModel.  See {@link Ext.grid.Column} for the configuration properties that may
-     * be specified.
-     * @property config
-     * @type Array
-     */
-    if(config.columns){
-        Ext.apply(this, config);
-        this.setConfig(config.columns, true);
-    }else{
-        this.setConfig(config, true);
-    }
-    this.addEvents(
-        /**
-         * @event widthchange
-         * Fires when the width of a column is programmaticially changed using
-         * <code>{@link #setColumnWidth}</code>.
-         * Note internal resizing suppresses the event from firing. See also
-         * {@link Ext.grid.GridPanel}.<code>{@link #columnresize}</code>.
-         * @param {ColumnModel} this
-         * @param {Number} columnIndex The column index
-         * @param {Number} newWidth The new width
-         */
-        "widthchange",
-        /**
-         * @event headerchange
-         * Fires when the text of a header changes.
-         * @param {ColumnModel} this
-         * @param {Number} columnIndex The column index
-         * @param {String} newText The new header text
-         */
-        "headerchange",
-        /**
-         * @event hiddenchange
-         * Fires when a column is hidden or "unhidden".
-         * @param {ColumnModel} this
-         * @param {Number} columnIndex The column index
-         * @param {Boolean} hidden true if hidden, false otherwise
-         */
-        "hiddenchange",
-        /**
-         * @event columnmoved
-         * Fires when a column is moved.
-         * @param {ColumnModel} this
-         * @param {Number} oldIndex
-         * @param {Number} newIndex
-         */
-        "columnmoved",
-        /**
-         * @event configchange
-         * Fires when the configuration is changed
-         * @param {ColumnModel} this
-         */
-        "configchange"
-    );
-    Ext.grid.ColumnModel.superclass.constructor.call(this);
-};
-Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
+Ext.grid.ColumnModel = Ext.extend(Ext.util.Observable, {
     /**
      * @cfg {Number} defaultWidth (optional) The width of columns which have no <tt>{@link #width}</tt>
      * specified (defaults to <tt>100</tt>).  This property shall preferably be configured through the
@@ -3221,6 +3432,66 @@ Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
      * configuration options to all <tt><b>{@link #columns}</b></tt>.  Configuration options specified with
      * individual {@link Ext.grid.Column column} configs will supersede these <tt><b>{@link #defaults}</b></tt>.
      */
+    
+    constructor : function(config){
+        /**
+            * An Array of {@link Ext.grid.Column Column definition} objects representing the configuration
+            * of this ColumnModel.  See {@link Ext.grid.Column} for the configuration properties that may
+            * be specified.
+            * @property config
+            * @type Array
+            */
+           if(config.columns){
+               Ext.apply(this, config);
+               this.setConfig(config.columns, true);
+           }else{
+               this.setConfig(config, true);
+           }
+           this.addEvents(
+               /**
+                * @event widthchange
+                * Fires when the width of a column is programmaticially changed using
+                * <code>{@link #setColumnWidth}</code>.
+                * Note internal resizing suppresses the event from firing. See also
+                * {@link Ext.grid.GridPanel}.<code>{@link #columnresize}</code>.
+                * @param {ColumnModel} this
+                * @param {Number} columnIndex The column index
+                * @param {Number} newWidth The new width
+                */
+               "widthchange",
+               /**
+                * @event headerchange
+                * Fires when the text of a header changes.
+                * @param {ColumnModel} this
+                * @param {Number} columnIndex The column index
+                * @param {String} newText The new header text
+                */
+               "headerchange",
+               /**
+                * @event hiddenchange
+                * Fires when a column is hidden or "unhidden".
+                * @param {ColumnModel} this
+                * @param {Number} columnIndex The column index
+                * @param {Boolean} hidden true if hidden, false otherwise
+                */
+               "hiddenchange",
+               /**
+                * @event columnmoved
+                * Fires when a column is moved.
+                * @param {ColumnModel} this
+                * @param {Number} oldIndex
+                * @param {Number} newIndex
+                */
+               "columnmoved",
+               /**
+                * @event configchange
+                * Fires when the configuration is changed
+                * @param {ColumnModel} this
+                */
+               "configchange"
+           );
+           Ext.grid.ColumnModel.superclass.constructor.call(this);
+    },
 
     /**
      * Returns the id of the column at the specified index.
@@ -3250,10 +3521,7 @@ Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
         if(!initial){ // cleanup
             delete this.totalWidth;
             for(i = 0, len = this.config.length; i < len; i++){
-                c = this.config[i];
-                if(c.editor){
-                    c.editor.destroy();
-                }
+                this.config[i].destroy();
             }
         }
 
@@ -3265,12 +3533,16 @@ Ext.extend(Ext.grid.ColumnModel, Ext.util.Observable, {
 
         this.config = config;
         this.lookup = {};
-        // if no id, create one
+
         for(i = 0, len = config.length; i < len; i++){
             c = Ext.applyIf(config[i], this.defaults);
+            // if no id, create one using column's ordinal position
+            if(Ext.isEmpty(c.id)){
+                c.id = i;
+            }
             if(!c.isColumn){
-                var cls = Ext.grid.Column.types[c.xtype || 'gridcolumn'];
-                c = new cls(c);
+                var Cls = Ext.grid.Column.types[c.xtype || 'gridcolumn'];
+                c = new Cls(c);
                 config[i] = c;
             }
             this.lookup[c.id] = c;
@@ -3343,8 +3615,10 @@ var columns = grid.getColumnModel().getColumnsBy(function(c){
   return c.hidden;
 });
 </code></pre>
-     * @param {Function} fn
-     * @param {Object} scope (optional)
+     * @param {Function} fn A function which, when passed a {@link Ext.grid.Column Column} object, must
+     * return <code>true</code> if the column is to be included in the returned Array.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function
+     * is executed. Defaults to this ColumnModel.
      * @return {Array} result
      */
     getColumnsBy : function(fn, scope){
@@ -3364,7 +3638,7 @@ var columns = grid.getColumnModel().getColumnsBy(function(c){
      * @return {Boolean}
      */
     isSortable : function(col){
-        return this.config[col].sortable;
+        return !!this.config[col].sortable;
     },
 
     /**
@@ -3387,6 +3661,10 @@ var columns = grid.getColumnModel().getColumnsBy(function(c){
         }
         return this.config[col].renderer;
     },
+    
+    getRendererScope : function(col){
+        return this.config[col].scope;
+    },
 
     /**
      * Sets the rendering (formatting) function for a column.  See {@link Ext.util.Format} for some
@@ -3548,7 +3826,11 @@ var grid = new Ext.grid.GridPanel({
      * @return {Boolean}
      */
     isCellEditable : function(colIndex, rowIndex){
-        return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
+        var c = this.config[colIndex],
+            ed = c.editable;
+            
+        //force boolean
+        return !!(ed || (!Ext.isDefined(ed) && c.editor));
     },
 
     /**
@@ -3571,22 +3853,24 @@ var grid = new Ext.grid.GridPanel({
         this.config[col].editable = editable;
     },
 
-
     /**
-     * Returns true if the column is hidden.
+     * Returns <tt>true</tt> if the column is <code>{@link Ext.grid.Column#hidden hidden}</code>,
+     * <tt>false</tt> otherwise.
      * @param {Number} colIndex The column index
      * @return {Boolean}
      */
     isHidden : function(colIndex){
-        return this.config[colIndex].hidden;
+        return !!this.config[colIndex].hidden; // ensure returns boolean
     },
 
-
     /**
-     * Returns true if the column width cannot be changed
+     * Returns <tt>true</tt> if the column is <code>{@link Ext.grid.Column#fixed fixed}</code>,
+     * <tt>false</tt> otherwise.
+     * @param {Number} colIndex The column index
+     * @return {Boolean}
      */
     isFixed : function(colIndex){
-        return this.config[colIndex].fixed;
+        return !!this.config[colIndex].fixed;
     },
 
     /**
@@ -3619,16 +3903,15 @@ myGrid.getColumnModel().setHidden(0, true); // hide column 0 (0 = the first colu
      * @param {Object} editor The editor object
      */
     setEditor : function(col, editor){
-        Ext.destroy(this.config[col].editor);
-        this.config[col].editor = editor;
+        this.config[col].setEditor(editor);
     },
 
     /**
      * Destroys this column model by purging any event listeners, and removing any editors.
      */
     destroy : function(){
-        for(var i = 0, c = this.config, len = c.length; i < len; i++){
-            Ext.destroy(c[i].editor);
+        for(var i = 0, len = this.config.length; i < len; i++){
+            this.config[i].destroy();
         }
         this.purgeListeners();
     }
@@ -3647,17 +3930,17 @@ Ext.grid.ColumnModel.defaultRenderer = function(value){
  * implemented by descendant classes.  This class should not be directly instantiated.\r
  * @constructor\r
  */\r
-Ext.grid.AbstractSelectionModel = function(){\r
-    this.locked = false;\r
-    Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);\r
-};\r
-\r
-Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable,  {\r
+Ext.grid.AbstractSelectionModel = Ext.extend(Ext.util.Observable,  {\r
     /**\r
      * The GridPanel for which this SelectionModel is handling selection. Read-only.\r
      * @type Object\r
      * @property grid\r
      */\r
+    \r
+    constructor : function(){\r
+        this.locked = false;\r
+        Ext.grid.AbstractSelectionModel.superclass.constructor.call(this);\r
+    },\r
 \r
     /** @ignore Called by the grid automatically. Do not call directly. */\r
     init : function(grid){\r
@@ -3700,60 +3983,59 @@ Ext.extend(Ext.grid.AbstractSelectionModel, Ext.util.Observable,  {
  * @constructor
  * @param {Object} config
  */
-Ext.grid.RowSelectionModel = function(config){
-    Ext.apply(this, config);
-    this.selections = new Ext.util.MixedCollection(false, function(o){
-        return o.id;
-    });
-
-    this.last = false;
-    this.lastActive = false;
-
-    this.addEvents(
-        /**
-         * @event selectionchange
-         * Fires when the selection changes
-         * @param {SelectionModel} this
-         */
-        "selectionchange",
-        /**
-         * @event beforerowselect
-         * Fires before a row is selected, return false to cancel the selection.
-         * @param {SelectionModel} this
-         * @param {Number} rowIndex The index to be selected
-         * @param {Boolean} keepExisting False if other selections will be cleared
-         * @param {Record} record The record to be selected
-         */
-        "beforerowselect",
-        /**
-         * @event rowselect
-         * Fires when a row is selected.
-         * @param {SelectionModel} this
-         * @param {Number} rowIndex The selected index
-         * @param {Ext.data.Record} r The selected record
-         */
-        "rowselect",
-        /**
-         * @event rowdeselect
-         * Fires when a row is deselected.  To prevent deselection
-         * {@link Ext.grid.AbstractSelectionModel#lock lock the selections}. 
-         * @param {SelectionModel} this
-         * @param {Number} rowIndex
-         * @param {Record} record
-         */
-        "rowdeselect"
-    );
-
-    Ext.grid.RowSelectionModel.superclass.constructor.call(this);
-};
-
-Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
+Ext.grid.RowSelectionModel = Ext.extend(Ext.grid.AbstractSelectionModel,  {
     /**
      * @cfg {Boolean} singleSelect
      * <tt>true</tt> to allow selection of only one row at a time (defaults to <tt>false</tt>
      * allowing multiple selections)
      */
     singleSelect : false,
+    
+    constructor : function(config){
+        Ext.apply(this, config);
+        this.selections = new Ext.util.MixedCollection(false, function(o){
+            return o.id;
+        });
+
+        this.last = false;
+        this.lastActive = false;
+
+        this.addEvents(
+               /**
+                * @event selectionchange
+                * Fires when the selection changes
+                * @param {SelectionModel} this
+                */
+               'selectionchange',
+               /**
+                * @event beforerowselect
+                * Fires before a row is selected, return false to cancel the selection.
+                * @param {SelectionModel} this
+                * @param {Number} rowIndex The index to be selected
+                * @param {Boolean} keepExisting False if other selections will be cleared
+                * @param {Record} record The record to be selected
+                */
+               'beforerowselect',
+               /**
+                * @event rowselect
+                * Fires when a row is selected.
+                * @param {SelectionModel} this
+                * @param {Number} rowIndex The selected index
+                * @param {Ext.data.Record} r The selected record
+                */
+               'rowselect',
+               /**
+                * @event rowdeselect
+                * Fires when a row is deselected.  To prevent deselection
+                * {@link Ext.grid.AbstractSelectionModel#lock lock the selections}. 
+                * @param {SelectionModel} this
+                * @param {Number} rowIndex
+                * @param {Record} record
+                */
+               'rowdeselect'
+        );
+        Ext.grid.RowSelectionModel.superclass.constructor.call(this);
+    },
 
     /**
      * @cfg {Boolean} moveEditorOnEnter
@@ -3764,18 +4046,11 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
     initEvents : function(){
 
         if(!this.grid.enableDragDrop && !this.grid.enableDrag){
-            this.grid.on("rowmousedown", this.handleMouseDown, this);
-        }else{ // allow click to work like normal
-            this.grid.on("rowclick", function(grid, rowIndex, e) {
-                if(e.button === 0 && !e.shiftKey && !e.ctrlKey) {
-                    this.selectRow(rowIndex, false);
-                    grid.view.focusRow(rowIndex);
-                }
-            }, this);
+            this.grid.on('rowmousedown', this.handleMouseDown, this);
         }
 
         this.rowNav = new Ext.KeyNav(this.grid.getGridEl(), {
-            "up" : function(e){
+            'up' : function(e){
                 if(!e.shiftKey || this.singleSelect){
                     this.selectPrevious(false);
                 }else if(this.last !== false && this.lastActive !== false){
@@ -3789,7 +4064,7 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
                     this.selectFirstRow();
                 }
             },
-            "down" : function(e){
+            'down' : function(e){
                 if(!e.shiftKey || this.singleSelect){
                     this.selectNext(false);
                 }else if(this.last !== false && this.lastActive !== false){
@@ -3806,10 +4081,12 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
             scope: this
         });
 
-        var view = this.grid.view;
-        view.on("refresh", this.onRefresh, this);
-        view.on("rowupdated", this.onRowUpdated, this);
-        view.on("rowremoved", this.onRemove, this);
+        this.grid.getView().on({
+            scope: this,
+            refresh: this.onRefresh,
+            rowupdated: this.onRowUpdated,
+            rowremoved: this.onRemove
+        });
     },
 
     // private
@@ -3824,7 +4101,7 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
             }
         }
         if(s.length != this.selections.getCount()){
-            this.fireEvent("selectionchange", this);
+            this.fireEvent('selectionchange', this);
         }
     },
 
@@ -3945,8 +4222,8 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
      * Calls the passed function with each selection. If the function returns
      * <tt>false</tt>, iteration is stopped and this function returns
      * <tt>false</tt>. Otherwise it returns <tt>true</tt>.
-     * @param {Function} fn
-     * @param {Object} scope (optional)
+     * @param {Function} fn The function to call upon each iteration. It is passed the selected {@link Ext.data.Record Record}.
+     * @param {Object} scope (optional) The scope (<code>this</code> reference) in which the function is executed. Defaults to this RowSelectionModel.
      * @return {Boolean} true if all selections were iterated
      */
     each : function(fn, scope){
@@ -4011,7 +4288,7 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
      * @return {Boolean}
      */
     isSelected : function(index){
-        var r = typeof index == "number" ? this.grid.store.getAt(index) : index;
+        var r = Ext.isNumber(index) ? this.grid.store.getAt(index) : index;
         return (r && this.selections.key(r.id) ? true : false);
     },
 
@@ -4120,7 +4397,7 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
             return;
         }
         var r = this.grid.store.getAt(index);
-        if(r && this.fireEvent("beforerowselect", this, index, keepExisting, r) !== false){
+        if(r && this.fireEvent('beforerowselect', this, index, keepExisting, r) !== false){
             if(!keepExisting || this.singleSelect){
                 this.clearSelections();
             }
@@ -4129,8 +4406,8 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
             if(!preventViewNotify){
                 this.grid.getView().onRowSelect(index);
             }
-            this.fireEvent("rowselect", this, index, r);
-            this.fireEvent("selectionchange", this);
+            this.fireEvent('rowselect', this, index, r);
+            this.fireEvent('selectionchange', this);
         }
     },
 
@@ -4159,8 +4436,8 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
             if(!preventViewNotify){
                 this.grid.getView().onRowDeselect(index);
             }
-            this.fireEvent("rowdeselect", this, index, r);
-            this.fireEvent("selectionchange", this);
+            this.fireEvent('rowdeselect', this, index, r);
+            this.fireEvent('selectionchange', this);
         }
     },
 
@@ -4178,7 +4455,12 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
 
     // private
     onEditorKey : function(field, e){
-        var k = e.getKey(), newCell, g = this.grid, ed = g.activeEditor;
+        var k = e.getKey(), 
+            newCell, 
+            g = this.grid, 
+            last = g.lastEdit,
+            ed = g.activeEditor,
+            ae, last, r, c;
         var shift = e.shiftKey;
         if(k == e.TAB){
             e.stopEvent();
@@ -4189,24 +4471,34 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
                 newCell = g.walkCells(ed.row, ed.col+1, 1, this.acceptsNav, this);
             }
         }else if(k == e.ENTER){
-            e.stopEvent();
-            ed.completeEdit();
             if(this.moveEditorOnEnter !== false){
                 if(shift){
-                    newCell = g.walkCells(ed.row - 1, ed.col, -1, this.acceptsNav, this);
+                    newCell = g.walkCells(last.row - 1, last.col, -1, this.acceptsNav, this);
                 }else{
-                    newCell = g.walkCells(ed.row + 1, ed.col, 1, this.acceptsNav, this);
+                    newCell = g.walkCells(last.row + 1, last.col, 1, this.acceptsNav, this);
                 }
             }
-        }else if(k == e.ESC){
-            ed.cancelEdit();
         }
         if(newCell){
-            g.startEditing(newCell[0], newCell[1]);
+            r = newCell[0];
+            c = newCell[1];
+
+            if(last.row != r){
+                this.selectRow(r); // *** highlight newly-selected cell and update selection
+            }
+
+            if(g.isEditor && g.editing){ // *** handle tabbing while editorgrid is in edit mode
+                ae = g.activeEditor;
+                if(ae && ae.field.triggerBlur){
+                    // *** if activeEditor is a TriggerField, explicitly call its triggerBlur() method
+                    ae.field.triggerBlur();
+                }
+            }
+            g.startEditing(r, c);
         }
     },
     
-    destroy: function(){
+    destroy : function(){
         if(this.rowNav){
             this.rowNav.disable();
             this.rowNav = null;
@@ -4220,28 +4512,7 @@ Ext.extend(Ext.grid.RowSelectionModel, Ext.grid.AbstractSelectionModel,  {
  * <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
@@ -4325,8 +4596,8 @@ Ext.grid.Column.prototype = {
      */\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
@@ -4338,7 +4609,10 @@ Ext.grid.Column.prototype = {
      * @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
@@ -4435,8 +4709,33 @@ var grid = new Ext.grid.GridPanel({
      * 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
+        var ed = this.editor;\r
+        delete this.editor;\r
+        this.setEditor(ed);\r
+    },\r
+\r
     /**\r
      * Optional. A function which returns displayable data when passed the following parameters:\r
      * <div class="mdetail-params"><ul>\r
@@ -4456,7 +4755,7 @@ var grid = new Ext.grid.GridPanel({
      * @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 '&#160;';\r
         }\r
         return value;\r
@@ -4466,6 +4765,32 @@ var grid = new Ext.grid.GridPanel({
     getEditor: function(rowIndex){\r
         return this.editable !== false ? this.editor : null;\r
     },\r
+    \r
+    /**\r
+     * Sets a new editor for this column.\r
+     * @param {Ext.Editor/Ext.form.Field} editor The editor to set\r
+     */\r
+    setEditor : function(editor){\r
+        if(this.editor){\r
+            this.editor.destroy();\r
+        }\r
+        this.editor = null;\r
+        if(editor){\r
+            //not an instance, create it\r
+            if(!editor.isXType){\r
+                editor = Ext.create(editor, 'textfield');\r
+            }\r
+            //check if it's wrapped in an editor\r
+            if(!editor.startEdit){\r
+                editor = new Ext.grid.GridEditor(editor);\r
+            }\r
+            this.editor = editor;\r
+        }\r
+    },\r
+    \r
+    destroy : function(){\r
+        this.setEditor(null);\r
+    },\r
 \r
     /**\r
      * Returns the {@link Ext.Editor editor} defined for this column that was created to wrap the {@link Ext.form.Field Field}\r
@@ -4474,26 +4799,15 @@ var grid = new Ext.grid.GridPanel({
      * @return {Ext.Editor}\r
      */\r
     getCellEditor: function(rowIndex){\r
-        var editor = this.getEditor(rowIndex);\r
-        if(editor){\r
-            if(!editor.startEdit){\r
-                if(!editor.gridEditor){\r
-                    editor.gridEditor = new Ext.grid.GridEditor(editor);\r
-                }\r
-                return editor.gridEditor;\r
-            }else if(editor.startEdit){\r
-                return editor;\r
-            }\r
-        }\r
-        return null;\r
+        return this.getEditor(rowIndex);\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
@@ -4532,7 +4846,7 @@ Ext.grid.BooleanColumn = Ext.extend(Ext.grid.Column, {
  * @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
@@ -4551,7 +4865,7 @@ Ext.grid.NumberColumn = Ext.extend(Ext.grid.Column, {
  * @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
@@ -4572,7 +4886,7 @@ Ext.grid.DateColumn = Ext.extend(Ext.grid.Column, {
  * @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
@@ -4583,7 +4897,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 = 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
@@ -4629,14 +4943,7 @@ Ext.grid.Column.types = {
  * @constructor
  * @param {Object} config The configuration options
  */
-Ext.grid.RowNumberer = function(config){
-    Ext.apply(this, config);
-    if(this.rowspan){
-        this.renderer = this.renderer.createDelegate(this);
-    }
-};
-
-Ext.grid.RowNumberer.prototype = {
+Ext.grid.RowNumberer = Ext.extend(Object, {
     /**
      * @cfg {String} header Any valid text or HTML fragment to display in the header cell for the row
      * number column (defaults to '').
@@ -4651,6 +4958,13 @@ Ext.grid.RowNumberer.prototype = {
      * @hide
      */
     sortable: false,
+    
+    constructor : function(config){
+        Ext.apply(this, config);
+        if(this.rowspan){
+            this.renderer = this.renderer.createDelegate(this);
+        }
+    },
 
     // private
     fixed:true,
@@ -4666,7 +4980,7 @@ Ext.grid.RowNumberer.prototype = {
         }
         return rowIndex+1;
     }
-};/**\r
+});/**\r
  * @class Ext.grid.CheckboxSelectionModel\r
  * @extends Ext.grid.RowSelectionModel\r
  * A custom selection model that renders a column of checkboxes that can be toggled to select or deselect rows.\r
@@ -4690,24 +5004,24 @@ Ext.grid.CheckboxSelectionModel = Ext.extend(Ext.grid.RowSelectionModel, {
      * <tt>'Select Rows'</tt>), but the automatic check all/none behavior will only work if the\r
      * <tt>'x-grid3-hd-checker'</tt> class is supplied.\r
      */\r
-    header: '<div class="x-grid3-hd-checker">&#160;</div>',\r
+    header : '<div class="x-grid3-hd-checker">&#160;</div>',\r
     /**\r
      * @cfg {Number} width The default width in pixels of the checkbox column (defaults to <tt>20</tt>).\r
      */\r
-    width: 20,\r
+    width : 20,\r
     /**\r
      * @cfg {Boolean} sortable <tt>true</tt> if the checkbox column is sortable (defaults to\r
      * <tt>false</tt>).\r
      */\r
-    sortable: false,\r
+    sortable : false,\r
 \r
     // private\r
-    menuDisabled:true,\r
-    fixed:true,\r
-    dataIndex: '',\r
-    id: 'checker',\r
+    menuDisabled : true,\r
+    fixed : true,\r
+    dataIndex : '',\r
+    id : 'checker',\r
 \r
-    constructor: function(){\r
+    constructor : function(){\r
         Ext.grid.CheckboxSelectionModel.superclass.constructor.apply(this, arguments);\r
 \r
         if(this.checkOnly){\r