Upgrade to ExtJS 3.0.0 - Released 07/06/2009
[extjs.git] / examples / grid / RowExpander.js
diff --git a/examples/grid/RowExpander.js b/examples/grid/RowExpander.js
deleted file mode 100644 (file)
index 93464c5..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-Ext.grid.RowExpander = function(config){\r
-    Ext.apply(this, config);\r
-\r
-    this.addEvents({\r
-        beforeexpand : true,\r
-        expand: true,\r
-        beforecollapse: true,\r
-        collapse: true\r
-    });\r
-\r
-    Ext.grid.RowExpander.superclass.constructor.call(this);\r
-\r
-    if(this.tpl){\r
-        if(typeof this.tpl == 'string'){\r
-            this.tpl = new Ext.Template(this.tpl);\r
-        }\r
-        this.tpl.compile();\r
-    }\r
-\r
-    this.state = {};\r
-    this.bodyContent = {};\r
-};\r
-\r
-Ext.extend(Ext.grid.RowExpander, Ext.util.Observable, {\r
-    header: "",\r
-    width: 20,\r
-    sortable: false,\r
-    fixed:true,\r
-    menuDisabled:true,\r
-    dataIndex: '',\r
-    id: 'expander',\r
-    lazyRender : true,\r
-    enableCaching: true,\r
-\r
-    getRowClass : function(record, rowIndex, p, ds){\r
-        p.cols = p.cols-1;\r
-        var content = this.bodyContent[record.id];\r
-        if(!content && !this.lazyRender){\r
-            content = this.getBodyContent(record, rowIndex);\r
-        }\r
-        if(content){\r
-            p.body = content;\r
-        }\r
-        return this.state[record.id] ? 'x-grid3-row-expanded' : 'x-grid3-row-collapsed';\r
-    },\r
-\r
-    init : function(grid){\r
-        this.grid = grid;\r
-\r
-        var view = grid.getView();\r
-        view.getRowClass = this.getRowClass.createDelegate(this);\r
-\r
-        view.enableRowBody = true;\r
-\r
-        grid.on('render', function(){\r
-            view.mainBody.on('mousedown', this.onMouseDown, this);\r
-        }, this);\r
-    },\r
-\r
-    getBodyContent : function(record, index){\r
-        if(!this.enableCaching){\r
-            return this.tpl.apply(record.data);\r
-        }\r
-        var content = this.bodyContent[record.id];\r
-        if(!content){\r
-            content = this.tpl.apply(record.data);\r
-            this.bodyContent[record.id] = content;\r
-        }\r
-        return content;\r
-    },\r
-\r
-    onMouseDown : function(e, t){\r
-        if(t.className == 'x-grid3-row-expander'){\r
-            e.stopEvent();\r
-            var row = e.getTarget('.x-grid3-row');\r
-            this.toggleRow(row);\r
-        }\r
-    },\r
-\r
-    renderer : function(v, p, record){\r
-        p.cellAttr = 'rowspan="2"';\r
-        return '<div class="x-grid3-row-expander">&#160;</div>';\r
-    },\r
-\r
-    beforeExpand : function(record, body, rowIndex){\r
-        if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){\r
-            if(this.tpl && this.lazyRender){\r
-                body.innerHTML = this.getBodyContent(record, rowIndex);\r
-            }\r
-            return true;\r
-        }else{\r
-            return false;\r
-        }\r
-    },\r
-\r
-    toggleRow : function(row){\r
-        if(typeof row == 'number'){\r
-            row = this.grid.view.getRow(row);\r
-        }\r
-        this[Ext.fly(row).hasClass('x-grid3-row-collapsed') ? 'expandRow' : 'collapseRow'](row);\r
-    },\r
-\r
-    expandRow : function(row){\r
-        if(typeof row == 'number'){\r
-            row = this.grid.view.getRow(row);\r
-        }\r
-        var record = this.grid.store.getAt(row.rowIndex);\r
-        var body = Ext.DomQuery.selectNode('tr:nth(2) div.x-grid3-row-body', row);\r
-        if(this.beforeExpand(record, body, row.rowIndex)){\r
-            this.state[record.id] = true;\r
-            Ext.fly(row).replaceClass('x-grid3-row-collapsed', 'x-grid3-row-expanded');\r
-            this.fireEvent('expand', this, record, body, row.rowIndex);\r
-        }\r
-    },\r
-\r
-    collapseRow : function(row){\r
-        if(typeof row == 'number'){\r
-            row = this.grid.view.getRow(row);\r
-        }\r
-        var record = this.grid.store.getAt(row.rowIndex);\r
-        var body = Ext.fly(row).child('tr:nth(1) div.x-grid3-row-body', true);\r
-        if(this.fireEvent('beforecollapse', this, record, body, row.rowIndex) !== false){\r
-            this.state[record.id] = false;\r
-            Ext.fly(row).replaceClass('x-grid3-row-expanded', 'x-grid3-row-collapsed');\r
-            this.fireEvent('collapse', this, record, body, row.rowIndex);\r
-        }\r
-    }\r
-});\r