/** * @class Ext.grid.plugin.RowExpander * Description */Ext.define('Ext.grid.plugin.RowExpander', { extend: 'Ext.Component', requires: [ 'Ext.grid.cell.Expander' ], alias: 'plugin.rowexpander', config: { grid: null, column: { xtype: 'gridcolumn', text: '', width: 50, resizable: false, hideable: false, sortable: false, editable: false, ignore: true, ignoreExport: true, cell: { xtype: 'expandercell' } } }, expanderSelector: '.' + Ext.baseCSSPrefix + 'expandercell .' + Ext.baseCSSPrefix + 'icon-el', init: function (grid) { var me = this, column = me.getColumn(); me.setGrid(grid); grid.insertColumn(0, column); }, applyColumn: function(column, oldColumn) { return Ext.factory(column, null, oldColumn); }, updateGrid: function (grid, oldGrid) { var me = this; if (grid) { grid.hasRowExpander = true; grid.addCls(Ext.baseCSSPrefix + 'has-rowexpander'); if (!grid.isConfiguring) { grid.insertColumn(0, this.me.getColumn()); } grid.refreshScroller(); grid.element.on({ tap: 'onGridTap', delegate: me.expanderSelector, scope: me }); } }, onGridTap: function(event) { var el = event.getTarget(), cell = Ext.Component.fromElement(el), row = cell.getParent(); row.toggleCollapsed(); }});