3 * Copyright(c) 2006-2009 Ext JS, LLC
5 * http://www.extjs.com/license
8 * @class Ext.grid.GridView
9 * @extends Ext.util.Observable
10 * <p>This class encapsulates the user interface of an {@link Ext.grid.GridPanel}.
11 * Methods of this class may be used to access user interface elements to enable
12 * special display effects. Do not change the DOM structure of the user interface.</p>
13 * <p>This class does not provide ways to manipulate the underlying data. The data
14 * model of a Grid is held in an {@link Ext.data.Store}.</p>
16 * @param {Object} config
18 Ext.grid.GridView = function(config){
19 Ext.apply(this, config);
20 // These events are only used internally by the grid components
23 * @event beforerowremoved
24 * Internal UI Event. Fired before a row is removed.
25 * @param {Ext.grid.GridView} view
26 * @param {Number} rowIndex The index of the row to be removed.
27 * @param {Ext.data.Record} record The Record to be removed
31 * @event beforerowsinserted
32 * Internal UI Event. Fired before rows are inserted.
33 * @param {Ext.grid.GridView} view
34 * @param {Number} firstRow The index of the first row to be inserted.
35 * @param {Number} lastRow The index of the last row to be inserted.
39 * @event beforerefresh
40 * Internal UI Event. Fired before the view is refreshed.
41 * @param {Ext.grid.GridView} view
46 * Internal UI Event. Fired after a row is removed.
47 * @param {Ext.grid.GridView} view
48 * @param {Number} rowIndex The index of the row that was removed.
49 * @param {Ext.data.Record} record The Record that was removed
54 * Internal UI Event. Fired after rows are inserted.
55 * @param {Ext.grid.GridView} view
56 * @param {Number} firstRow The index of the first inserted.
57 * @param {Number} lastRow The index of the last row inserted.
62 * Internal UI Event. Fired after a row has been updated.
63 * @param {Ext.grid.GridView} view
64 * @param {Number} firstRow The index of the row updated.
65 * @param {Ext.data.record} record The Record backing the row updated.
70 * Internal UI Event. Fired after the GridView's body has been refreshed.
71 * @param {Ext.grid.GridView} view
75 Ext.grid.GridView.superclass.constructor.call(this);
78 Ext.extend(Ext.grid.GridView, Ext.util.Observable, {
80 * Override this function to apply custom CSS classes to rows during rendering. You can also supply custom
81 * parameters to the row template for the current row to customize how it is rendered using the <b>rowParams</b>
82 * parameter. This function should return the CSS class name (or empty string '' for none) that will be added
83 * to the row's wrapping div. To apply multiple class names, simply return them space-delimited within the string
84 * (e.g., 'my-class another-class'). Example usage:
88 showPreview: true, // custom property
89 enableRowBody: true, // required to create a second, full-width row to show expanded Record data
90 getRowClass: function(record, rowIndex, rp, ds){ // rp = rowParams
92 rp.body = '<p>'+record.data.excerpt+'</p>';
93 return 'x-grid3-row-expanded';
95 return 'x-grid3-row-collapsed';
99 * @param {Record} record The {@link Ext.data.Record} corresponding to the current row.
100 * @param {Number} index The row index.
101 * @param {Object} rowParams A config object that is passed to the row template during rendering that allows
102 * customization of various aspects of a grid row.
103 * <p>If {@link #enableRowBody} is configured <b><tt></tt>true</b>, then the following properties may be set
104 * by this function, and will be used to render a full-width expansion row below each grid row:</p>
106 * <li><code>body</code> : String <div class="sub-desc">An HTML fragment to be used as the expansion row's body content (defaults to '').</div></li>
107 * <li><code>bodyStyle</code> : String <div class="sub-desc">A CSS style specification that will be applied to the expansion row's <tr> element. (defaults to '').</div></li>
109 * The following property will be passed in, and may be appended to:
111 * <li><code>tstyle</code> : String <div class="sub-desc">A CSS style specification that willl be applied to the <table> element which encapsulates
112 * both the standard grid row, and any expansion row.</div></li>
114 * @param {Store} store The {@link Ext.data.Store} this grid is bound to
115 * @method getRowClass
116 * @return {String} a CSS class name to add to the row.
119 * @cfg {Boolean} enableRowBody True to add a second TR element per row that can be used to provide a row body
120 * that spans beneath the data row. Use the {@link #getRowClass} method's rowParams config to customize the row body.
123 * @cfg {String} emptyText Default text (html tags are accepted) to display in the grid body when no rows
124 * are available (defaults to ''). This value will be used to update the <tt>{@link #mainBody}</tt>:
126 this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
130 * @cfg {Boolean} headersDisabled True to disable the grid column headers (defaults to <tt>false</tt>).
131 * Use the {@link Ext.grid.ColumnModel ColumnModel} <tt>{@link Ext.grid.ColumnModel#menuDisabled menuDisabled}</tt>
132 * config to disable the <i>menu</i> for individual columns. While this config is true the
133 * following will be disabled:<div class="mdetail-params"><ul>
134 * <li>clicking on header to sort</li>
135 * <li>the trigger to reveal the menu.</li>
139 * <p>A customized implementation of a {@link Ext.dd.DragZone DragZone} which provides default implementations
140 * of the template methods of DragZone to enable dragging of the selected rows of a GridPanel.
141 * See {@link Ext.grid.GridDragZone} for details.</p>
142 * <p>This will <b>only</b> be present:<div class="mdetail-params"><ul>
143 * <li><i>if</i> the owning GridPanel was configured with {@link Ext.grid.GridPanel#enableDragDrop enableDragDrop}: <tt>true</tt>.</li>
144 * <li><i>after</i> the owning GridPanel has been rendered.</li>
147 * @type {Ext.grid.GridDragZone}
150 * @cfg {Boolean} deferEmptyText True to defer <tt>{@link #emptyText}</tt> being applied until the store's
151 * first load (defaults to <tt>true</tt>).
153 deferEmptyText : true,
155 * @cfg {Number} scrollOffset The amount of space to reserve for the vertical scrollbar
156 * (defaults to <tt>undefined</tt>). If an explicit value isn't specified, this will be automatically
159 scrollOffset : undefined,
161 * @cfg {Boolean} autoFill
162 * Defaults to <tt>false</tt>. Specify <tt>true</tt> to have the column widths re-proportioned
163 * when the grid is <b>initially rendered</b>. The
164 * {@link Ext.grid.Column#width initially configured width}</tt> of each column will be adjusted
165 * to fit the grid width and prevent horizontal scrolling. If columns are later resized (manually
166 * or programmatically), the other columns in the grid will <b>not</b> be resized to fit the grid width.
167 * See <tt>{@link #forceFit}</tt> also.
171 * @cfg {Boolean} forceFit
172 * Defaults to <tt>false</tt>. Specify <tt>true</tt> to have the column widths re-proportioned
173 * at <b>all times</b>. The {@link Ext.grid.Column#width initially configured width}</tt> of each
174 * column will be adjusted to fit the grid width and prevent horizontal scrolling. If columns are
175 * later resized (manually or programmatically), the other columns in the grid <b>will</b> be resized
176 * to fit the grid width. See <tt>{@link #autoFill}</tt> also.
180 * @cfg {Array} sortClasses The CSS classes applied to a header when it is sorted. (defaults to <tt>['sort-asc', 'sort-desc']</tt>)
182 sortClasses : ['sort-asc', 'sort-desc'],
184 * @cfg {String} sortAscText The text displayed in the 'Sort Ascending' menu item (defaults to <tt>'Sort Ascending'</tt>)
186 sortAscText : 'Sort Ascending',
188 * @cfg {String} sortDescText The text displayed in the 'Sort Descending' menu item (defaults to <tt>'Sort Descending'</tt>)
190 sortDescText : 'Sort Descending',
192 * @cfg {String} columnsText The text displayed in the 'Columns' menu item (defaults to <tt>'Columns'</tt>)
194 columnsText : 'Columns',
197 * @cfg {String} selectedRowClass The CSS class applied to a selected row (defaults to <tt>'x-grid3-row-selected'</tt>). An
198 * example overriding the default styling:
200 .x-grid3-row-selected {background-color: yellow;}
202 * Note that this only controls the row, and will not do anything for the text inside it. To style inner
203 * facets (like text) use something like:
205 .x-grid3-row-selected .x-grid3-cell-inner {
211 selectedRowClass : 'x-grid3-row-selected',
215 tdClass : 'x-grid3-cell',
216 hdCls : 'x-grid3-hd',
220 * @cfg {Number} cellSelectorDepth The number of levels to search for cells in event delegation (defaults to <tt>4</tt>)
222 cellSelectorDepth : 4,
224 * @cfg {Number} rowSelectorDepth The number of levels to search for rows in event delegation (defaults to <tt>10</tt>)
226 rowSelectorDepth : 10,
229 * @cfg {String} cellSelector The selector used to find cells internally (defaults to <tt>'td.x-grid3-cell'</tt>)
231 cellSelector : 'td.x-grid3-cell',
233 * @cfg {String} rowSelector The selector used to find rows internally (defaults to <tt>'div.x-grid3-row'</tt>)
235 rowSelector : 'div.x-grid3-row',
238 firstRowCls: 'x-grid3-row-first',
239 lastRowCls: 'x-grid3-row-last',
240 rowClsRe: /(?:^|\s+)x-grid3-row-(first|last|alt)(?:\s+|$)/g,
242 /* -------------------------------- UI Specific ----------------------------- */
245 initTemplates : function(){
246 var ts = this.templates || {};
248 ts.master = new Ext.Template(
249 '<div class="x-grid3" hidefocus="true">',
250 '<div class="x-grid3-viewport">',
251 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{ostyle}">{header}</div></div><div class="x-clear"></div></div>',
252 '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
254 '<div class="x-grid3-resize-marker"> </div>',
255 '<div class="x-grid3-resize-proxy"> </div>',
261 ts.header = new Ext.Template(
262 '<table border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
263 '<thead><tr class="x-grid3-hd-row">{cells}</tr></thead>',
269 ts.hcell = new Ext.Template(
270 '<td class="x-grid3-hd x-grid3-cell x-grid3-td-{id} {css}" style="{style}"><div {tooltip} {attr} class="x-grid3-hd-inner x-grid3-hd-{id}" unselectable="on" style="{istyle}">', this.grid.enableHdMenu ? '<a class="x-grid3-hd-btn" href="#"></a>' : '',
271 '{value}<img class="x-grid3-sort-icon" src="', Ext.BLANK_IMAGE_URL, '" />',
277 ts.body = new Ext.Template('{rows}');
281 ts.row = new Ext.Template(
282 '<div class="x-grid3-row {alt}" style="{tstyle}"><table class="x-grid3-row-table" border="0" cellspacing="0" cellpadding="0" style="{tstyle}">',
283 '<tbody><tr>{cells}</tr>',
284 (this.enableRowBody ? '<tr class="x-grid3-row-body-tr" style="{bodyStyle}"><td colspan="{cols}" class="x-grid3-body-cell" tabIndex="0" hidefocus="on"><div class="x-grid3-row-body">{body}</div></td></tr>' : ''),
285 '</tbody></table></div>'
290 ts.cell = new Ext.Template(
291 '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} {css}" style="{style}" tabIndex="0" {cellAttr}>',
292 '<div class="x-grid3-cell-inner x-grid3-col-{id}" unselectable="on" {attr}>{value}</div>',
299 if(t && typeof t.compile == 'function' && !t.compiled){
300 t.disableFormats = true;
306 this.colRe = new RegExp('x-grid3-td-([^\\s]+)', '');
311 if(!this._flyweight){
312 this._flyweight = new Ext.Element.Flyweight(document.body);
314 this._flyweight.dom = el;
315 return this._flyweight;
319 getEditorParent : function(){
320 return this.scroller.dom;
324 initElements : function(){
327 var el = this.grid.getGridEl().dom.firstChild;
328 var cs = el.childNodes;
332 this.mainWrap = new E(cs[0]);
333 this.mainHd = new E(this.mainWrap.dom.firstChild);
335 if(this.grid.hideHeaders){
336 this.mainHd.setDisplayed(false);
339 this.innerHd = this.mainHd.dom.firstChild;
340 this.scroller = new E(this.mainWrap.dom.childNodes[1]);
342 this.scroller.setStyle('overflow-x', 'hidden');
345 * <i>Read-only</i>. The GridView's body Element which encapsulates all rows in the Grid.
346 * This {@link Ext.Element Element} is only available after the GridPanel has been rendered.
350 this.mainBody = new E(this.scroller.dom.firstChild);
352 this.focusEl = new E(this.scroller.dom.childNodes[1]);
353 this.focusEl.swallowEvent('click', true);
355 this.resizeMarker = new E(cs[1]);
356 this.resizeProxy = new E(cs[2]);
360 getRows : function(){
361 return this.hasRows() ? this.mainBody.dom.childNodes : [];
364 // finder methods, used with delegation
367 findCell : function(el){
371 return this.fly(el).findParent(this.cellSelector, this.cellSelectorDepth);
375 * <p>Return the index of the grid column which contains the passed HTMLElement.</p>
376 * See also {@link #findRowIndex}
377 * @param {HTMLElement} el The target element
378 * @return {Number} The column index, or <b>false</b> if the target element is not within a row of this GridView.
380 findCellIndex : function(el, requiredCls){
381 var cell = this.findCell(el);
382 if(cell && (!requiredCls || this.fly(cell).hasClass(requiredCls))){
383 return this.getCellIndex(cell);
389 getCellIndex : function(el){
391 var m = el.className.match(this.colRe);
393 return this.cm.getIndexById(m[1]);
400 findHeaderCell : function(el){
401 var cell = this.findCell(el);
402 return cell && this.fly(cell).hasClass(this.hdCls) ? cell : null;
406 findHeaderIndex : function(el){
407 return this.findCellIndex(el, this.hdCls);
411 * Return the HtmlElement representing the grid row which contains the passed element.
412 * @param {HTMLElement} el The target HTMLElement
413 * @return {HTMLElement} The row element, or null if the target element is not within a row of this GridView.
415 findRow : function(el){
419 return this.fly(el).findParent(this.rowSelector, this.rowSelectorDepth);
423 * <p>Return the index of the grid row which contains the passed HTMLElement.</p>
424 * See also {@link #findCellIndex}
425 * @param {HTMLElement} el The target HTMLElement
426 * @return {Number} The row index, or <b>false</b> if the target element is not within a row of this GridView.
428 findRowIndex : function(el){
429 var r = this.findRow(el);
430 return r ? r.rowIndex : false;
433 // getter methods for fetching elements dynamically in the grid
436 * Return the <tt><div></tt> HtmlElement which represents a Grid row for the specified index.
437 * @param {Number} index The row index
438 * @return {HtmlElement} The div element.
440 getRow : function(row){
441 return this.getRows()[row];
445 * Returns the grid's <tt><td></tt> HtmlElement at the specified coordinates.
446 * @param {Number} row The row index in which to find the cell.
447 * @param {Number} col The column index of the cell.
448 * @return {HtmlElement} The td at the specified coordinates.
450 getCell : function(row, col){
451 return this.getRow(row).getElementsByTagName('td')[col];
455 * Return the <tt><td></tt> HtmlElement which represents the Grid's header cell for the specified column index.
456 * @param {Number} index The column index
457 * @return {HtmlElement} The td element.
459 getHeaderCell : function(index){
460 return this.mainHd.dom.getElementsByTagName('td')[index];
463 // manipulating elements
465 // private - use getRowClass to apply custom row classes
466 addRowClass : function(row, cls){
467 var r = this.getRow(row);
469 this.fly(r).addClass(cls);
474 removeRowClass : function(row, cls){
475 var r = this.getRow(row);
477 this.fly(r).removeClass(cls);
482 removeRow : function(row){
483 Ext.removeNode(this.getRow(row));
484 this.syncFocusEl(row);
488 removeRows : function(firstRow, lastRow){
489 var bd = this.mainBody.dom;
490 for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
491 Ext.removeNode(bd.childNodes[firstRow]);
493 this.syncFocusEl(firstRow);
499 getScrollState : function(){
500 var sb = this.scroller.dom;
501 return {left: sb.scrollLeft, top: sb.scrollTop};
505 restoreScroll : function(state){
506 var sb = this.scroller.dom;
507 sb.scrollLeft = state.left;
508 sb.scrollTop = state.top;
512 * Scrolls the grid to the top
514 scrollToTop : function(){
515 this.scroller.dom.scrollTop = 0;
516 this.scroller.dom.scrollLeft = 0;
520 syncScroll : function(){
521 this.syncHeaderScroll();
522 var mb = this.scroller.dom;
523 this.grid.fireEvent('bodyscroll', mb.scrollLeft, mb.scrollTop);
527 syncHeaderScroll : function(){
528 var mb = this.scroller.dom;
529 this.innerHd.scrollLeft = mb.scrollLeft;
530 this.innerHd.scrollLeft = mb.scrollLeft; // second time for IE (1/2 time first fails, other browsers ignore)
534 updateSortIcon : function(col, dir){
535 var sc = this.sortClasses;
536 var hds = this.mainHd.select('td').removeClass(sc);
537 hds.item(col).addClass(sc[dir == 'DESC' ? 1 : 0]);
541 updateAllColumnWidths : function(){
542 var tw = this.getTotalWidth(),
543 clen = this.cm.getColumnCount(),
547 for(i = 0; i < clen; i++){
548 ws[i] = this.getColumnWidth(i);
550 this.innerHd.firstChild.style.width = this.getOffsetWidth();
551 this.innerHd.firstChild.firstChild.style.width = tw;
552 this.mainBody.dom.style.width = tw;
553 for(i = 0; i < clen; i++){
554 var hd = this.getHeaderCell(i);
555 hd.style.width = ws[i];
558 var ns = this.getRows(), row, trow;
559 for(i = 0, len = ns.length; i < len; i++){
561 row.style.width = tw;
563 row.firstChild.style.width = tw;
564 trow = row.firstChild.rows[0];
565 for (var j = 0; j < clen; j++) {
566 trow.childNodes[j].style.width = ws[j];
571 this.onAllColumnWidthsUpdated(ws, tw);
575 updateColumnWidth : function(col, width){
576 var w = this.getColumnWidth(col);
577 var tw = this.getTotalWidth();
578 this.innerHd.firstChild.style.width = this.getOffsetWidth();
579 this.innerHd.firstChild.firstChild.style.width = tw;
580 this.mainBody.dom.style.width = tw;
581 var hd = this.getHeaderCell(col);
584 var ns = this.getRows(), row;
585 for(var i = 0, len = ns.length; i < len; i++){
587 row.style.width = tw;
589 row.firstChild.style.width = tw;
590 row.firstChild.rows[0].childNodes[col].style.width = w;
594 this.onColumnWidthUpdated(col, w, tw);
598 updateColumnHidden : function(col, hidden){
599 var tw = this.getTotalWidth();
600 this.innerHd.firstChild.style.width = this.getOffsetWidth();
601 this.innerHd.firstChild.firstChild.style.width = tw;
602 this.mainBody.dom.style.width = tw;
603 var display = hidden ? 'none' : '';
605 var hd = this.getHeaderCell(col);
606 hd.style.display = display;
608 var ns = this.getRows(), row;
609 for(var i = 0, len = ns.length; i < len; i++){
611 row.style.width = tw;
613 row.firstChild.style.width = tw;
614 row.firstChild.rows[0].childNodes[col].style.display = display;
618 this.onColumnHiddenUpdated(col, hidden, tw);
619 delete this.lastViewWidth; // force recalc
624 doRender : function(cs, rs, ds, startRow, colCount, stripe){
625 var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1;
626 var tstyle = 'width:'+this.getTotalWidth()+';';
628 var buf = [], cb, c, p = {}, rp = {tstyle: tstyle}, r;
629 for(var j = 0, len = rs.length; j < len; j++){
631 var rowIndex = (j+startRow);
632 for(var i = 0; i < colCount; i++){
635 p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
636 p.attr = p.cellAttr = '';
637 p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
639 if(Ext.isEmpty(p.value)){
642 if(this.markDirty && r.dirty && typeof r.modified[c.name] !== 'undefined'){
643 p.css += ' x-grid3-dirty-cell';
645 cb[cb.length] = ct.apply(p);
648 if(stripe && ((rowIndex+1) % 2 === 0)){
649 alt[0] = 'x-grid3-row-alt';
652 alt[1] = ' x-grid3-dirty-row';
655 if(this.getRowClass){
656 alt[2] = this.getRowClass(r, rowIndex, rp, ds);
658 rp.alt = alt.join(' ');
659 rp.cells = cb.join('');
660 buf[buf.length] = rt.apply(rp);
666 processRows : function(startRow, skipStripe){
667 if(!this.ds || this.ds.getCount() < 1){
670 var rows = this.getRows();
671 skipStripe = skipStripe || !this.grid.stripeRows;
672 startRow = startRow || 0;
673 Ext.each(rows, function(row, idx){
676 row.className = row.className.replace(this.rowClsRe, ' ');
677 if ((idx + 1) % 2 === 0){
678 row.className += ' x-grid3-row-alt';
682 // add first/last-row classes
684 Ext.fly(rows[0]).addClass(this.firstRowCls);
686 Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls);
689 afterRender : function(){
690 if(!this.ds || !this.cm){
693 this.mainBody.dom.innerHTML = this.renderRows() || ' ';
694 this.processRows(0, true);
696 if(this.deferEmptyText !== true){
697 this.applyEmptyText();
702 renderUI : function(){
704 var header = this.renderHeaders();
705 var body = this.templates.body.apply({rows:' '});
708 var html = this.templates.master.apply({
711 ostyle: 'width:'+this.getOffsetWidth()+';',
712 bstyle: 'width:'+this.getTotalWidth()+';'
717 g.getGridEl().dom.innerHTML = html;
721 // get mousedowns early
722 Ext.fly(this.innerHd).on('click', this.handleHdDown, this);
725 mouseover: this.handleHdOver,
726 mouseout: this.handleHdOut,
727 mousemove: this.handleHdMove
730 this.scroller.on('scroll', this.syncScroll, this);
731 if(g.enableColumnResize !== false){
732 this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
735 if(g.enableColumnMove){
736 this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
737 this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
740 if(g.enableHdMenu !== false){
741 this.hmenu = new Ext.menu.Menu({id: g.id + '-hctx'});
743 {itemId:'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'},
744 {itemId:'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'}
746 if(g.enableColumnHide !== false){
747 this.colMenu = new Ext.menu.Menu({id:g.id + '-hcols-menu'});
750 beforeshow: this.beforeColMenuShow,
751 itemclick: this.handleHdMenuClick
753 this.hmenu.add('-', {
756 text: this.columnsText,
758 iconCls: 'x-cols-icon'
761 this.hmenu.on('itemclick', this.handleHdMenuClick, this);
764 if(g.trackMouseOver){
767 mouseover: this.onRowOver,
768 mouseout: this.onRowOut
772 if(g.enableDragDrop || g.enableDrag){
773 this.dragZone = new Ext.grid.GridDragZone(g, {
774 ddGroup : g.ddGroup || 'GridDD'
778 this.updateHeaderSortState();
785 return; // not rendered
788 var c = g.getGridEl();
789 var csize = c.getSize(true);
790 var vw = csize.width;
792 if(!g.hideHeaders && (vw < 20 || csize.height < 20)){ // display: none?
797 this.scroller.dom.style.overflow = 'visible';
799 this.scroller.dom.style.position = 'static';
802 this.el.setSize(csize.width, csize.height);
804 var hdHeight = this.mainHd.getHeight();
805 var vh = csize.height - (hdHeight);
807 this.scroller.setSize(vw, vh);
809 this.innerHd.style.width = (vw)+'px';
813 if(this.lastViewWidth != vw){
814 this.fitColumns(false, false);
815 this.lastViewWidth = vw;
819 this.syncHeaderScroll();
821 this.onLayout(vw, vh);
824 // template functions for subclasses and plugins
825 // these functions include precalculated values
826 onLayout : function(vw, vh){
830 onColumnWidthUpdated : function(col, w, tw){
834 onAllColumnWidthsUpdated : function(ws, tw){
838 onColumnHiddenUpdated : function(col, hidden, tw){
842 updateColumnText : function(col, text){
846 afterMove : function(colIndex){
850 /* ----------------------------------- Core Specific -------------------------------------------*/
852 init : function(grid){
855 this.initTemplates();
856 this.initData(grid.store, grid.colModel);
861 getColumnId : function(index){
862 return this.cm.getColumnId(index);
866 getOffsetWidth : function() {
867 return (this.cm.getTotalWidth() + this.getScrollOffset()) + 'px';
870 getScrollOffset: function(){
871 return Ext.num(this.scrollOffset, Ext.getScrollBarWidth());
875 renderHeaders : function(){
881 len = cm.getColumnCount(),
884 for(var i = 0; i < len; i++){
885 p.id = cm.getColumnId(i);
886 p.value = cm.getColumnHeader(i) || '';
887 p.style = this.getColumnStyle(i, true);
888 p.tooltip = this.getColumnTooltip(i);
889 p.css = i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '');
890 if(cm.config[i].align == 'right'){
891 p.istyle = 'padding-right:16px';
895 cb[cb.length] = ct.apply(p);
897 return ts.header.apply({cells: cb.join(''), tstyle:'width:'+this.getTotalWidth()+';'});
901 getColumnTooltip : function(i){
902 var tt = this.cm.getColumnTooltip(i);
904 if(Ext.QuickTips.isEnabled()){
905 return 'ext:qtip="'+tt+'"';
907 return 'title="'+tt+'"';
914 beforeUpdate : function(){
915 this.grid.stopEditing(true);
919 updateHeaders : function(){
920 this.innerHd.firstChild.innerHTML = this.renderHeaders();
921 this.innerHd.firstChild.style.width = this.getOffsetWidth();
922 this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth();
926 * Focuses the specified row.
927 * @param {Number} row The row index
929 focusRow : function(row){
930 this.focusCell(row, 0, false);
934 * Focuses the specified cell.
935 * @param {Number} row The row index
936 * @param {Number} col The column index
938 focusCell : function(row, col, hscroll){
939 this.syncFocusEl(this.ensureVisible(row, col, hscroll));
941 this.focusEl.focus();
943 this.focusEl.focus.defer(1, this.focusEl);
947 resolveCell : function(row, col, hscroll){
948 if(typeof row != "number"){
954 if(row < 0 || row >= this.ds.getCount()){
957 col = (col !== undefined ? col : 0);
959 var rowEl = this.getRow(row),
961 colCount = cm.getColumnCount(),
963 if(!(hscroll === false && col === 0)){
964 while(col < colCount && cm.isHidden(col)){
967 cellEl = this.getCell(row, col);
970 return {row: rowEl, cell: cellEl};
973 getResolvedXY : function(resolved){
977 var s = this.scroller.dom, c = resolved.cell, r = resolved.row;
978 return c ? Ext.fly(c).getXY() : [this.el.getX(), Ext.fly(r).getY()];
981 syncFocusEl : function(row, col, hscroll){
983 if(!Ext.isArray(xy)){
984 row = Math.min(row, Math.max(0, this.getRows().length-1));
985 xy = this.getResolvedXY(this.resolveCell(row, col, hscroll));
987 this.focusEl.setXY(xy||this.scroller.getXY());
990 ensureVisible : function(row, col, hscroll){
991 var resolved = this.resolveCell(row, col, hscroll);
992 if(!resolved || !resolved.row){
996 var rowEl = resolved.row,
997 cellEl = resolved.cell,
998 c = this.scroller.dom,
1003 while(p && p != stop){
1004 ctop += p.offsetTop;
1008 ctop -= this.mainHd.dom.offsetHeight;
1009 stop = parseInt(c.scrollTop, 10);
1011 var cbot = ctop + rowEl.offsetHeight,
1012 ch = c.clientHeight,
1018 }else if(cbot > sbot){
1019 c.scrollTop = cbot-ch;
1022 if(hscroll !== false){
1023 var cleft = parseInt(cellEl.offsetLeft, 10);
1024 var cright = cleft + cellEl.offsetWidth;
1026 var sleft = parseInt(c.scrollLeft, 10);
1027 var sright = sleft + c.clientWidth;
1029 c.scrollLeft = cleft;
1030 }else if(cright > sright){
1031 c.scrollLeft = cright-c.clientWidth;
1034 return this.getResolvedXY(resolved);
1038 insertRows : function(dm, firstRow, lastRow, isUpdate){
1039 var last = dm.getCount() - 1;
1040 if(!isUpdate && firstRow === 0 && lastRow >= last){
1044 this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
1046 var html = this.renderRows(firstRow, lastRow),
1047 before = this.getRow(firstRow);
1050 Ext.fly(this.getRow(0)).removeClass(this.firstRowCls);
1052 Ext.DomHelper.insertHtml('beforeBegin', before, html);
1054 var r = this.getRow(last - 1);
1056 Ext.fly(r).removeClass(this.lastRowCls);
1058 Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html);
1061 this.fireEvent('rowsinserted', this, firstRow, lastRow);
1062 this.processRows(firstRow);
1063 }else if(firstRow === 0 || firstRow >= last){
1064 //ensure first/last row is kept after an update.
1065 Ext.fly(this.getRow(firstRow)).addClass(firstRow === 0 ? this.firstRowCls : this.lastRowCls);
1068 this.syncFocusEl(firstRow);
1072 deleteRows : function(dm, firstRow, lastRow){
1073 if(dm.getRowCount()<1){
1076 this.fireEvent('beforerowsdeleted', this, firstRow, lastRow);
1078 this.removeRows(firstRow, lastRow);
1080 this.processRows(firstRow);
1081 this.fireEvent('rowsdeleted', this, firstRow, lastRow);
1086 getColumnStyle : function(col, isHeader){
1087 var style = !isHeader ? (this.cm.config[col].css || '') : '';
1088 style += 'width:'+this.getColumnWidth(col)+';';
1089 if(this.cm.isHidden(col)){
1090 style += 'display:none;';
1092 var align = this.cm.config[col].align;
1094 style += 'text-align:'+align+';';
1100 getColumnWidth : function(col){
1101 var w = this.cm.getColumnWidth(col);
1102 if(typeof w == 'number'){
1103 return (Ext.isBorderBox || (Ext.isWebKit && !Ext.isSafari2) ? w : (w - this.borderWidth > 0 ? w - this.borderWidth : 0)) + 'px';
1109 getTotalWidth : function(){
1110 return this.cm.getTotalWidth()+'px';
1114 fitColumns : function(preventRefresh, onlyExpand, omitColumn){
1115 var cm = this.cm, i;
1116 var tw = cm.getTotalWidth(false);
1117 var aw = this.grid.getGridEl().getWidth(true)-this.getScrollOffset();
1119 if(aw < 20){ // not initialized, so don't screw up the default widths
1122 var extra = aw - tw;
1128 var vc = cm.getColumnCount(true);
1129 var ac = vc-(typeof omitColumn == 'number' ? 1 : 0);
1132 omitColumn = undefined;
1134 var colCount = cm.getColumnCount();
1139 for (i = 0; i < colCount; i++){
1140 if(!cm.isHidden(i) && !cm.isFixed(i) && i !== omitColumn){
1141 w = cm.getColumnWidth(i);
1148 var frac = (aw - cm.getTotalWidth())/width;
1149 while (cols.length){
1152 cm.setColumnWidth(i, Math.max(this.grid.minColumnWidth, Math.floor(w + w*frac)), true);
1155 if((tw = cm.getTotalWidth(false)) > aw){
1156 var adjustCol = ac != vc ? omitColumn : extraCol;
1157 cm.setColumnWidth(adjustCol, Math.max(1,
1158 cm.getColumnWidth(adjustCol)- (tw-aw)), true);
1161 if(preventRefresh !== true){
1162 this.updateAllColumnWidths();
1170 autoExpand : function(preventUpdate){
1171 var g = this.grid, cm = this.cm;
1172 if(!this.userResized && g.autoExpandColumn){
1173 var tw = cm.getTotalWidth(false);
1174 var aw = this.grid.getGridEl().getWidth(true)-this.getScrollOffset();
1176 var ci = cm.getIndexById(g.autoExpandColumn);
1177 var currentWidth = cm.getColumnWidth(ci);
1178 var cw = Math.min(Math.max(((aw-tw)+currentWidth), g.autoExpandMin), g.autoExpandMax);
1179 if(cw != currentWidth){
1180 cm.setColumnWidth(ci, cw, true);
1181 if(preventUpdate !== true){
1182 this.updateColumnWidth(ci, cw);
1190 getColumnData : function(){
1191 // build a map for all the columns
1192 var cs = [], cm = this.cm, colCount = cm.getColumnCount();
1193 for(var i = 0; i < colCount; i++){
1194 var name = cm.getDataIndex(i);
1196 name : (typeof name == 'undefined' ? this.ds.fields.get(i).name : name),
1197 renderer : cm.getRenderer(i),
1198 id : cm.getColumnId(i),
1199 style : this.getColumnStyle(i)
1206 renderRows : function(startRow, endRow){
1207 // pull in all the crap needed to render rows
1208 var g = this.grid, cm = g.colModel, ds = g.store, stripe = g.stripeRows;
1209 var colCount = cm.getColumnCount();
1211 if(ds.getCount() < 1){
1215 var cs = this.getColumnData();
1217 startRow = startRow || 0;
1218 endRow = typeof endRow == "undefined"? ds.getCount()-1 : endRow;
1220 // records to render
1221 var rs = ds.getRange(startRow, endRow);
1223 return this.doRender(cs, rs, ds, startRow, colCount, stripe);
1227 renderBody : function(){
1228 var markup = this.renderRows() || ' ';
1229 return this.templates.body.apply({rows: markup});
1233 refreshRow : function(record){
1234 var ds = this.ds, index;
1235 if(typeof record == 'number'){
1237 record = ds.getAt(index);
1242 index = ds.indexOf(record);
1247 this.insertRows(ds, index, index, true);
1248 this.getRow(index).rowIndex = index;
1249 this.onRemove(ds, record, index+1, true);
1250 this.fireEvent('rowupdated', this, index, record);
1254 * Refreshs the grid UI
1255 * @param {Boolean} headersToo (optional) True to also refresh the headers
1257 refresh : function(headersToo){
1258 this.fireEvent('beforerefresh', this);
1259 this.grid.stopEditing(true);
1261 var result = this.renderBody();
1262 this.mainBody.update(result).setWidth(this.getTotalWidth());
1263 if(headersToo === true){
1264 this.updateHeaders();
1265 this.updateHeaderSortState();
1267 this.processRows(0, true);
1269 this.applyEmptyText();
1270 this.fireEvent('refresh', this);
1274 applyEmptyText : function(){
1275 if(this.emptyText && !this.hasRows()){
1276 this.mainBody.update('<div class="x-grid-empty">' + this.emptyText + '</div>');
1281 updateHeaderSortState : function(){
1282 var state = this.ds.getSortState();
1286 if(!this.sortState || (this.sortState.field != state.field || this.sortState.direction != state.direction)){
1287 this.grid.fireEvent('sortchange', this.grid, state);
1289 this.sortState = state;
1290 var sortColumn = this.cm.findColumnIndex(state.field);
1291 if(sortColumn != -1){
1292 var sortDir = state.direction;
1293 this.updateSortIcon(sortColumn, sortDir);
1298 destroy : function(){
1300 Ext.menu.MenuMgr.unregister(this.colMenu);
1301 this.colMenu.destroy();
1302 delete this.colMenu;
1305 Ext.menu.MenuMgr.unregister(this.hmenu);
1306 this.hmenu.destroy();
1310 this.initData(null, null);
1311 this.purgeListeners();
1312 Ext.fly(this.innerHd).un("click", this.handleHdDown, this);
1314 if(this.grid.enableColumnMove){
1317 this.columnDrag.proxy.ghost,
1318 this.columnDrag.proxy.el,
1320 this.columnDrop.proxyTop,
1321 this.columnDrop.proxyBottom,
1322 this.columnDrag.dragData.ddel,
1323 this.columnDrag.dragData.header
1325 if (this.columnDrag.proxy.anim) {
1326 Ext.destroy(this.columnDrag.proxy.anim);
1328 delete this.columnDrag.proxy.ghost;
1329 delete this.columnDrag.dragData.ddel;
1330 delete this.columnDrag.dragData.header;
1331 this.columnDrag.destroy();
1332 delete Ext.dd.DDM.locationCache[this.columnDrag.id];
1333 delete this.columnDrag._domRef;
1335 delete this.columnDrop.proxyTop;
1336 delete this.columnDrop.proxyBottom;
1337 this.columnDrop.destroy();
1338 delete Ext.dd.DDM.locationCache["gridHeader" + this.grid.getGridEl().id];
1339 delete this.columnDrop._domRef;
1340 delete Ext.dd.DDM.ids[this.columnDrop.ddGroup];
1343 if (this.splitone){ // enableColumnResize
1344 this.splitone.destroy();
1345 delete this.splitone._domRef;
1346 delete Ext.dd.DDM.ids["gridSplitters" + this.grid.getGridEl().id];
1349 Ext.fly(this.innerHd).removeAllListeners();
1350 Ext.removeNode(this.innerHd);
1351 delete this.innerHd;
1368 delete this.grid.container;
1371 this.dragZone.destroy();
1374 Ext.dd.DDM.currentTarget = null;
1375 delete Ext.dd.DDM.locationCache[this.grid.getGridEl().id];
1377 Ext.EventManager.removeResizeListener(this.onWindowResize, this);
1381 onDenyColumnHide : function(){
1386 render : function(){
1388 var ct = this.grid.ownerCt;
1389 if (ct && ct.getLayout()){
1390 ct.on('afterlayout', function(){
1391 this.fitColumns(true, true);
1392 this.updateHeaders();
1393 }, this, {single: true});
1395 this.fitColumns(true, true);
1397 }else if(this.forceFit){
1398 this.fitColumns(true, false);
1399 }else if(this.grid.autoExpandColumn){
1400 this.autoExpand(true);
1406 /* --------------------------------- Model Events and Handlers --------------------------------*/
1408 initData : function(ds, cm){
1410 this.ds.un('load', this.onLoad, this);
1411 this.ds.un('datachanged', this.onDataChange, this);
1412 this.ds.un('add', this.onAdd, this);
1413 this.ds.un('remove', this.onRemove, this);
1414 this.ds.un('update', this.onUpdate, this);
1415 this.ds.un('clear', this.onClear, this);
1416 if(this.ds !== ds && this.ds.autoDestroy){
1424 datachanged: this.onDataChange,
1426 remove: this.onRemove,
1427 update: this.onUpdate,
1434 this.cm.un('configchange', this.onColConfigChange, this);
1435 this.cm.un('widthchange', this.onColWidthChange, this);
1436 this.cm.un('headerchange', this.onHeaderChange, this);
1437 this.cm.un('hiddenchange', this.onHiddenChange, this);
1438 this.cm.un('columnmoved', this.onColumnMove, this);
1441 delete this.lastViewWidth;
1444 configchange: this.onColConfigChange,
1445 widthchange: this.onColWidthChange,
1446 headerchange: this.onHeaderChange,
1447 hiddenchange: this.onHiddenChange,
1448 columnmoved: this.onColumnMove
1455 onDataChange : function(){
1457 this.updateHeaderSortState();
1458 this.syncFocusEl(0);
1462 onClear : function(){
1464 this.syncFocusEl(0);
1468 onUpdate : function(ds, record){
1469 this.refreshRow(record);
1473 onAdd : function(ds, records, index){
1474 this.insertRows(ds, index, index + (records.length-1));
1478 onRemove : function(ds, record, index, isUpdate){
1479 if(isUpdate !== true){
1480 this.fireEvent('beforerowremoved', this, index, record);
1482 this.removeRow(index);
1483 if(isUpdate !== true){
1484 this.processRows(index);
1485 this.applyEmptyText();
1486 this.fireEvent('rowremoved', this, index, record);
1491 onLoad : function(){
1492 this.scrollToTop.defer(Ext.isGecko ? 1 : 0, this);
1496 onColWidthChange : function(cm, col, width){
1497 this.updateColumnWidth(col, width);
1501 onHeaderChange : function(cm, col, text){
1502 this.updateHeaders();
1506 onHiddenChange : function(cm, col, hidden){
1507 this.updateColumnHidden(col, hidden);
1511 onColumnMove : function(cm, oldIndex, newIndex){
1512 this.indexMap = null;
1513 var s = this.getScrollState();
1515 this.restoreScroll(s);
1516 this.afterMove(newIndex);
1517 this.grid.fireEvent('columnmove', oldIndex, newIndex);
1521 onColConfigChange : function(){
1522 delete this.lastViewWidth;
1523 this.indexMap = null;
1527 /* -------------------- UI Events and Handlers ------------------------------ */
1529 initUI : function(grid){
1530 grid.on('headerclick', this.onHeaderClick, this);
1534 initEvents : function(){
1538 onHeaderClick : function(g, index){
1539 if(this.headersDisabled || !this.cm.isSortable(index)){
1542 g.stopEditing(true);
1543 g.store.sort(this.cm.getDataIndex(index));
1547 onRowOver : function(e, t){
1549 if((row = this.findRowIndex(t)) !== false){
1550 this.addRowClass(row, 'x-grid3-row-over');
1555 onRowOut : function(e, t){
1557 if((row = this.findRowIndex(t)) !== false && !e.within(this.getRow(row), true)){
1558 this.removeRowClass(row, 'x-grid3-row-over');
1563 handleWheel : function(e){
1564 e.stopPropagation();
1568 onRowSelect : function(row){
1569 this.addRowClass(row, this.selectedRowClass);
1573 onRowDeselect : function(row){
1574 this.removeRowClass(row, this.selectedRowClass);
1578 onCellSelect : function(row, col){
1579 var cell = this.getCell(row, col);
1581 this.fly(cell).addClass('x-grid3-cell-selected');
1586 onCellDeselect : function(row, col){
1587 var cell = this.getCell(row, col);
1589 this.fly(cell).removeClass('x-grid3-cell-selected');
1594 onColumnSplitterMoved : function(i, w){
1595 this.userResized = true;
1596 var cm = this.grid.colModel;
1597 cm.setColumnWidth(i, w, true);
1600 this.fitColumns(true, false, i);
1601 this.updateAllColumnWidths();
1603 this.updateColumnWidth(i, w);
1604 this.syncHeaderScroll();
1607 this.grid.fireEvent('columnresize', i, w);
1611 handleHdMenuClick : function(item){
1612 var index = this.hdCtxIndex,
1615 id = item.getItemId();
1618 ds.sort(cm.getDataIndex(index), 'ASC');
1621 ds.sort(cm.getDataIndex(index), 'DESC');
1624 index = cm.getIndexById(id.substr(4));
1626 if(item.checked && cm.getColumnsBy(this.isHideableColumn, this).length <= 1){
1627 this.onDenyColumnHide();
1630 cm.setHidden(index, item.checked);
1637 isHideableColumn : function(c){
1638 return !c.hidden && !c.fixed;
1642 beforeColMenuShow : function(){
1643 var cm = this.cm, colCount = cm.getColumnCount();
1644 this.colMenu.removeAll();
1645 for(var i = 0; i < colCount; i++){
1646 if(cm.config[i].fixed !== true && cm.config[i].hideable !== false){
1647 this.colMenu.add(new Ext.menu.CheckItem({
1648 itemId: 'col-'+cm.getColumnId(i),
1649 text: cm.getColumnHeader(i),
1650 checked: !cm.isHidden(i),
1652 disabled: cm.config[i].hideable === false
1659 handleHdDown : function(e, t){
1660 if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
1662 var hd = this.findHeaderCell(t);
1663 Ext.fly(hd).addClass('x-grid3-hd-menu-open');
1664 var index = this.getCellIndex(hd);
1665 this.hdCtxIndex = index;
1666 var ms = this.hmenu.items, cm = this.cm;
1667 ms.get('asc').setDisabled(!cm.isSortable(index));
1668 ms.get('desc').setDisabled(!cm.isSortable(index));
1669 this.hmenu.on('hide', function(){
1670 Ext.fly(hd).removeClass('x-grid3-hd-menu-open');
1671 }, this, {single:true});
1672 this.hmenu.show(t, 'tl-bl?');
1677 handleHdOver : function(e, t){
1678 var hd = this.findHeaderCell(t);
1679 if(hd && !this.headersDisabled){
1680 this.activeHdRef = t;
1681 this.activeHdIndex = this.getCellIndex(hd);
1682 var fly = this.fly(hd);
1683 this.activeHdRegion = fly.getRegion();
1684 if(!this.cm.isMenuDisabled(this.activeHdIndex)){
1685 fly.addClass('x-grid3-hd-over');
1686 this.activeHdBtn = fly.child('.x-grid3-hd-btn');
1687 if(this.activeHdBtn){
1688 this.activeHdBtn.dom.style.height = (hd.firstChild.offsetHeight-1)+'px';
1695 handleHdMove : function(e, t){
1696 var hd = this.findHeaderCell(this.activeHdRef);
1697 if(hd && !this.headersDisabled){
1698 var hw = this.splitHandleWidth || 5,
1699 r = this.activeHdRegion,
1703 if(this.grid.enableColumnResize !== false){
1704 if(x - r.left <= hw && this.cm.isResizable(this.activeHdIndex-1)){
1705 cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'e-resize' : 'col-resize'; // col-resize not always supported
1706 }else if(r.right - x <= (!this.activeHdBtn ? hw : 2) && this.cm.isResizable(this.activeHdIndex)){
1707 cur = Ext.isAir ? 'move' : Ext.isWebKit ? 'w-resize' : 'col-resize';
1715 handleHdOut : function(e, t){
1716 var hd = this.findHeaderCell(t);
1717 if(hd && (!Ext.isIE || !e.within(hd, true))){
1718 this.activeHdRef = null;
1719 this.fly(hd).removeClass('x-grid3-hd-over');
1720 hd.style.cursor = '';
1725 hasRows : function(){
1726 var fc = this.mainBody.dom.firstChild;
1727 return fc && fc.nodeType == 1 && fc.className != 'x-grid-empty';
1731 bind : function(d, c){
1732 this.initData(d, c);
1738 // This is a support class used internally by the Grid components
1739 Ext.grid.GridView.SplitDragZone = function(grid, hd){
1741 this.view = grid.getView();
1742 this.marker = this.view.resizeMarker;
1743 this.proxy = this.view.resizeProxy;
1744 Ext.grid.GridView.SplitDragZone.superclass.constructor.call(this, hd,
1745 'gridSplitters' + this.grid.getGridEl().id, {
1746 dragElId : Ext.id(this.proxy.dom), resizeFrame:false
1748 this.scroll = false;
1749 this.hw = this.view.splitHandleWidth || 5;
1751 Ext.extend(Ext.grid.GridView.SplitDragZone, Ext.dd.DDProxy, {
1753 b4StartDrag : function(x, y){
1754 this.view.headersDisabled = true;
1755 var h = this.view.mainWrap.getHeight();
1756 this.marker.setHeight(h);
1758 this.marker.alignTo(this.view.getHeaderCell(this.cellIndex), 'tl-tl', [-2, 0]);
1759 this.proxy.setHeight(h);
1760 var w = this.cm.getColumnWidth(this.cellIndex);
1761 var minw = Math.max(w-this.grid.minColumnWidth, 0);
1762 this.resetConstraints();
1763 this.setXConstraint(minw, 1000);
1764 this.setYConstraint(0, 0);
1765 this.minX = x - minw;
1766 this.maxX = x + 1000;
1768 Ext.dd.DDProxy.prototype.b4StartDrag.call(this, x, y);
1772 handleMouseDown : function(e){
1773 var t = this.view.findHeaderCell(e.getTarget());
1775 var xy = this.view.fly(t).getXY(), x = xy[0], y = xy[1];
1776 var exy = e.getXY(), ex = exy[0];
1777 var w = t.offsetWidth, adjust = false;
1778 if((ex - x) <= this.hw){
1780 }else if((x+w) - ex <= this.hw){
1783 if(adjust !== false){
1784 this.cm = this.grid.colModel;
1785 var ci = this.view.getCellIndex(t);
1787 if (ci + adjust < 0) {
1790 while(this.cm.isHidden(ci+adjust)){
1797 this.cellIndex = ci+adjust;
1799 if(this.cm.isResizable(this.cellIndex) && !this.cm.isFixed(this.cellIndex)){
1800 Ext.grid.GridView.SplitDragZone.superclass.handleMouseDown.apply(this, arguments);
1802 }else if(this.view.columnDrag){
1803 this.view.columnDrag.callHandleMouseDown(e);
1808 endDrag : function(e){
1811 var endX = Math.max(this.minX, e.getPageX());
1812 var diff = endX - this.startPos;
1813 v.onColumnSplitterMoved(this.cellIndex, this.cm.getColumnWidth(this.cellIndex)+diff);
1814 setTimeout(function(){
1815 v.headersDisabled = false;
1819 autoOffset : function(){