3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
4 <title>The source code</title>
5 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
6 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <body onload="prettyPrint();">
9 <pre class="prettyprint lang-js">/*!
10 * Ext JS Library 3.3.1
11 * Copyright(c) 2006-2010 Sencha Inc.
12 * licensing@sencha.com
13 * http://www.sencha.com/license
16 * Ext JS Library 3.3.0
17 * Copyright(c) 2006-2010 Ext JS, Inc.
19 * http://www.extjs.com/license
21 Ext.ns('Ext.ux.grid');
23 Ext.ux.grid.LockingGridView = Ext.extend(Ext.grid.GridView, {
25 unlockText : 'Unlock',
27 lockedBorderWidth : 1,
30 * This option ensures that height between the rows is synchronized
31 * between the locked and unlocked sides. This option only needs to be used
32 * when the row heights aren't predictable.
36 initTemplates : function(){
37 var ts = this.templates || {};
40 ts.masterTpl = new Ext.Template(
41 '<div class="x-grid3" hidefocus="true">',
42 '<div class="x-grid3-locked">',
43 '<div class="x-grid3-header"><div class="x-grid3-header-inner"><div class="x-grid3-header-offset" style="{lstyle}">{lockedHeader}</div></div><div class="x-clear"></div></div>',
44 '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{lstyle}">{lockedBody}</div><div class="x-grid3-scroll-spacer"></div></div>',
46 '<div class="x-grid3-viewport x-grid3-unlocked">',
47 '<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>',
48 '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
50 '<div class="x-grid3-resize-marker"> </div>',
51 '<div class="x-grid3-resize-proxy"> </div>',
58 Ext.ux.grid.LockingGridView.superclass.initTemplates.call(this);
61 getEditorParent : function(ed){
65 initElements : function(){
66 var el = Ext.get(this.grid.getGridEl().dom.firstChild),
67 lockedWrap = el.child('div.x-grid3-locked'),
68 lockedHd = lockedWrap.child('div.x-grid3-header'),
69 lockedScroller = lockedWrap.child('div.x-grid3-scroller'),
70 mainWrap = el.child('div.x-grid3-viewport'),
71 mainHd = mainWrap.child('div.x-grid3-header'),
72 scroller = mainWrap.child('div.x-grid3-scroller');
74 if (this.grid.hideHeaders) {
75 lockedHd.setDisplayed(false);
76 mainHd.setDisplayed(false);
80 scroller.setStyle('overflow-x', 'hidden');
87 innerHd : mainHd.dom.firstChild,
89 mainBody: scroller.child('div.x-grid3-body'),
90 focusEl : scroller.child('a'),
91 resizeMarker: el.child('div.x-grid3-resize-marker'),
92 resizeProxy : el.child('div.x-grid3-resize-proxy'),
93 lockedWrap: lockedWrap,
95 lockedScroller: lockedScroller,
96 lockedBody: lockedScroller.child('div.x-grid3-body'),
97 lockedInnerHd: lockedHd.child('div.x-grid3-header-inner', true)
100 this.focusEl.swallowEvent('click', true);
103 getLockedRows : function(){
104 return this.hasRows() ? this.lockedBody.dom.childNodes : [];
107 getLockedRow : function(row){
108 return this.getLockedRows()[row];
111 getCell : function(row, col){
112 var lockedLen = this.cm.getLockedCount();
114 return this.getLockedRow(row).getElementsByTagName('td')[col];
116 return Ext.ux.grid.LockingGridView.superclass.getCell.call(this, row, col - lockedLen);
119 getHeaderCell : function(index){
120 var lockedLen = this.cm.getLockedCount();
121 if(index < lockedLen){
122 return this.lockedHd.dom.getElementsByTagName('td')[index];
124 return Ext.ux.grid.LockingGridView.superclass.getHeaderCell.call(this, index - lockedLen);
127 addRowClass : function(row, cls){
128 var lockedRow = this.getLockedRow(row);
130 this.fly(lockedRow).addClass(cls);
132 Ext.ux.grid.LockingGridView.superclass.addRowClass.call(this, row, cls);
135 removeRowClass : function(row, cls){
136 var lockedRow = this.getLockedRow(row);
138 this.fly(lockedRow).removeClass(cls);
140 Ext.ux.grid.LockingGridView.superclass.removeRowClass.call(this, row, cls);
143 removeRow : function(row) {
144 Ext.removeNode(this.getLockedRow(row));
145 Ext.ux.grid.LockingGridView.superclass.removeRow.call(this, row);
148 removeRows : function(firstRow, lastRow){
149 var lockedBody = this.lockedBody.dom,
151 for(; rowIndex <= lastRow; rowIndex++){
152 Ext.removeNode(lockedBody.childNodes[firstRow]);
154 Ext.ux.grid.LockingGridView.superclass.removeRows.call(this, firstRow, lastRow);
157 syncScroll : function(e){
158 this.lockedScroller.dom.scrollTop = this.scroller.dom.scrollTop;
159 Ext.ux.grid.LockingGridView.superclass.syncScroll.call(this, e);
162 updateSortIcon : function(col, dir){
163 var sortClasses = this.sortClasses,
164 lockedHeaders = this.lockedHd.select('td').removeClass(sortClasses),
165 headers = this.mainHd.select('td').removeClass(sortClasses),
166 lockedLen = this.cm.getLockedCount(),
167 cls = sortClasses[dir == 'DESC' ? 1 : 0];
170 lockedHeaders.item(col).addClass(cls);
172 headers.item(col - lockedLen).addClass(cls);
176 updateAllColumnWidths : function(){
177 var tw = this.getTotalWidth(),
178 clen = this.cm.getColumnCount(),
179 lw = this.getLockedWidth(),
180 llen = this.cm.getLockedCount(),
182 this.updateLockedWidth();
183 for(i = 0; i < clen; i++){
184 ws[i] = this.getColumnWidth(i);
185 var hd = this.getHeaderCell(i);
186 hd.style.width = ws[i];
188 var lns = this.getLockedRows(), ns = this.getRows(), row, trow, j;
189 for(i = 0, len = ns.length; i < len; i++){
191 row.style.width = lw;
193 row.firstChild.style.width = lw;
194 trow = row.firstChild.rows[0];
195 for (j = 0; j < llen; j++) {
196 trow.childNodes[j].style.width = ws[j];
200 row.style.width = tw;
202 row.firstChild.style.width = tw;
203 trow = row.firstChild.rows[0];
204 for (j = llen; j < clen; j++) {
205 trow.childNodes[j - llen].style.width = ws[j];
209 this.onAllColumnWidthsUpdated(ws, tw);
210 this.syncHeaderHeight();
213 updateColumnWidth : function(col, width){
214 var w = this.getColumnWidth(col),
215 llen = this.cm.getLockedCount(),
217 this.updateLockedWidth();
219 ns = this.getLockedRows();
220 rw = this.getLockedWidth();
224 rw = this.getTotalWidth();
227 var hd = this.getHeaderCell(col);
229 for(var i = 0, len = ns.length; i < len; i++){
231 row.style.width = rw;
233 row.firstChild.style.width = rw;
234 row.firstChild.rows[0].childNodes[c].style.width = w;
237 this.onColumnWidthUpdated(col, w, this.getTotalWidth());
238 this.syncHeaderHeight();
241 updateColumnHidden : function(col, hidden){
242 var llen = this.cm.getLockedCount(),
244 display = hidden ? 'none' : '';
245 this.updateLockedWidth();
247 ns = this.getLockedRows();
248 rw = this.getLockedWidth();
252 rw = this.getTotalWidth();
255 var hd = this.getHeaderCell(col);
256 hd.style.display = display;
257 for(var i = 0, len = ns.length; i < len; i++){
259 row.style.width = rw;
261 row.firstChild.style.width = rw;
262 row.firstChild.rows[0].childNodes[c].style.display = display;
265 this.onColumnHiddenUpdated(col, hidden, this.getTotalWidth());
266 delete this.lastViewWidth;
270 doRender : function(cs, rs, ds, startRow, colCount, stripe){
271 var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1,
272 tstyle = 'width:'+this.getTotalWidth()+';',
273 lstyle = 'width:'+this.getLockedWidth()+';',
274 buf = [], lbuf = [], cb, lcb, c, p = {}, rp = {}, r;
275 for(var j = 0, len = rs.length; j < len; j++){
276 r = rs[j]; cb = []; lcb = [];
277 var rowIndex = (j+startRow);
278 for(var i = 0; i < colCount; i++){
281 p.css = (i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '')) +
282 (this.cm.config[i].cellCls ? ' ' + this.cm.config[i].cellCls : '');
283 p.attr = p.cellAttr = '';
284 p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
286 if(Ext.isEmpty(p.value)){
289 if(this.markDirty && r.dirty && Ext.isDefined(r.modified[c.name])){
290 p.css += ' x-grid3-dirty-cell';
293 lcb[lcb.length] = ct.apply(p);
295 cb[cb.length] = ct.apply(p);
299 if(stripe && ((rowIndex+1) % 2 === 0)){
300 alt[0] = 'x-grid3-row-alt';
303 alt[1] = ' x-grid3-dirty-row';
306 if(this.getRowClass){
307 alt[2] = this.getRowClass(r, rowIndex, rp, ds);
309 rp.alt = alt.join(' ');
310 rp.cells = cb.join('');
312 buf[buf.length] = rt.apply(rp);
313 rp.cells = lcb.join('');
315 lbuf[lbuf.length] = rt.apply(rp);
317 return [buf.join(''), lbuf.join('')];
319 processRows : function(startRow, skipStripe){
320 if(!this.ds || this.ds.getCount() < 1){
323 var rows = this.getRows(),
324 lrows = this.getLockedRows(),
326 skipStripe = skipStripe || !this.grid.stripeRows;
327 startRow = startRow || 0;
328 for(var i = 0, len = rows.length; i < len; ++i){
334 row.className = row.className.replace(this.rowClsRe, ' ');
335 lrow.className = lrow.className.replace(this.rowClsRe, ' ');
336 if ((i + 1) % 2 === 0){
337 row.className += ' x-grid3-row-alt';
338 lrow.className += ' x-grid3-row-alt';
341 this.syncRowHeights(row, lrow);
344 Ext.fly(rows[0]).addClass(this.firstRowCls);
345 Ext.fly(lrows[0]).addClass(this.firstRowCls);
347 Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls);
348 Ext.fly(lrows[lrows.length - 1]).addClass(this.lastRowCls);
351 syncRowHeights: function(row1, row2){
352 if(this.syncHeights){
353 var el1 = Ext.get(row1),
355 h1 = el1.getHeight(),
356 h2 = el2.getHeight();
366 afterRender : function(){
367 if(!this.ds || !this.cm){
370 var bd = this.renderRows() || [' ', ' '];
371 this.mainBody.dom.innerHTML = bd[0];
372 this.lockedBody.dom.innerHTML = bd[1];
373 this.processRows(0, true);
374 if(this.deferEmptyText !== true){
375 this.applyEmptyText();
377 this.grid.fireEvent('viewready', this.grid);
380 renderUI : function(){
381 var templates = this.templates,
382 header = this.renderHeaders(),
383 body = templates.body.apply({rows:' '});
385 return templates.masterTpl.apply({
388 ostyle: 'width:' + this.getOffsetWidth() + ';',
389 bstyle: 'width:' + this.getTotalWidth() + ';',
391 lockedHeader: header[1],
392 lstyle: 'width:'+this.getLockedWidth()+';'
396 afterRenderUI: function(){
399 Ext.fly(this.innerHd).on('click', this.handleHdDown, this);
400 Ext.fly(this.lockedInnerHd).on('click', this.handleHdDown, this);
403 mouseover: this.handleHdOver,
404 mouseout: this.handleHdOut,
405 mousemove: this.handleHdMove
409 mouseover: this.handleHdOver,
410 mouseout: this.handleHdOut,
411 mousemove: this.handleHdMove
413 this.scroller.on('scroll', this.syncScroll, this);
414 if(g.enableColumnResize !== false){
415 this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
416 this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom));
417 this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom));
419 if(g.enableColumnMove){
420 this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
421 this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd));
422 this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd));
423 this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
425 if(g.enableHdMenu !== false){
426 this.hmenu = new Ext.menu.Menu({id: g.id + '-hctx'});
428 {itemId: 'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'},
429 {itemId: 'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'}
431 if(this.grid.enableColLock !== false){
433 {itemId: 'lock', text: this.lockText, cls: 'xg-hmenu-lock'},
434 {itemId: 'unlock', text: this.unlockText, cls: 'xg-hmenu-unlock'}
437 if(g.enableColumnHide !== false){
438 this.colMenu = new Ext.menu.Menu({id:g.id + '-hcols-menu'});
441 beforeshow: this.beforeColMenuShow,
442 itemclick: this.handleHdMenuClick
444 this.hmenu.add('-', {
447 text: this.columnsText,
449 iconCls: 'x-cols-icon'
452 this.hmenu.on('itemclick', this.handleHdMenuClick, this);
454 if(g.trackMouseOver){
457 mouseover: this.onRowOver,
458 mouseout: this.onRowOut
462 mouseover: this.onRowOver,
463 mouseout: this.onRowOut
467 if(g.enableDragDrop || g.enableDrag){
468 this.dragZone = new Ext.grid.GridDragZone(g, {
469 ddGroup : g.ddGroup || 'GridDD'
472 this.updateHeaderSortState();
480 var c = g.getGridEl();
481 var csize = c.getSize(true);
482 var vw = csize.width;
483 if(!g.hideHeaders && (vw < 20 || csize.height < 20)){
486 this.syncHeaderHeight();
488 this.scroller.dom.style.overflow = 'visible';
489 this.lockedScroller.dom.style.overflow = 'visible';
491 this.scroller.dom.style.position = 'static';
492 this.lockedScroller.dom.style.position = 'static';
495 this.el.setSize(csize.width, csize.height);
496 var hdHeight = this.mainHd.getHeight();
497 var vh = csize.height - (hdHeight);
499 this.updateLockedWidth();
501 if(this.lastViewWidth != vw){
502 this.fitColumns(false, false);
503 this.lastViewWidth = vw;
507 this.syncHeaderScroll();
509 this.onLayout(vw, vh);
512 getOffsetWidth : function() {
513 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth() + this.getScrollOffset()) + 'px';
516 renderHeaders : function(){
522 len = cm.getColumnCount(),
524 for(var i = 0; i < len; i++){
525 p.id = cm.getColumnId(i);
526 p.value = cm.getColumnHeader(i) || '';
527 p.style = this.getColumnStyle(i, true);
528 p.tooltip = this.getColumnTooltip(i);
529 p.css = (i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '')) +
530 (cm.config[i].headerCls ? ' ' + cm.config[i].headerCls : '');
531 if(cm.config[i].align == 'right'){
532 p.istyle = 'padding-right:16px';
537 lcb[lcb.length] = ct.apply(p);
539 cb[cb.length] = ct.apply(p);
542 return [ts.header.apply({cells: cb.join(''), tstyle:'width:'+this.getTotalWidth()+';'}),
543 ts.header.apply({cells: lcb.join(''), tstyle:'width:'+this.getLockedWidth()+';'})];
546 updateHeaders : function(){
547 var hd = this.renderHeaders();
548 this.innerHd.firstChild.innerHTML = hd[0];
549 this.innerHd.firstChild.style.width = this.getOffsetWidth();
550 this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth();
551 this.lockedInnerHd.firstChild.innerHTML = hd[1];
552 var lw = this.getLockedWidth();
553 this.lockedInnerHd.firstChild.style.width = lw;
554 this.lockedInnerHd.firstChild.firstChild.style.width = lw;
557 getResolvedXY : function(resolved){
561 var c = resolved.cell, r = resolved.row;
562 return c ? Ext.fly(c).getXY() : [this.scroller.getX(), Ext.fly(r).getY()];
565 syncFocusEl : function(row, col, hscroll){
566 Ext.ux.grid.LockingGridView.superclass.syncFocusEl.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
569 ensureVisible : function(row, col, hscroll){
570 return Ext.ux.grid.LockingGridView.superclass.ensureVisible.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
573 insertRows : function(dm, firstRow, lastRow, isUpdate){
574 var last = dm.getCount() - 1;
575 if(!isUpdate && firstRow === 0 && lastRow >= last){
579 this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
581 var html = this.renderRows(firstRow, lastRow),
582 before = this.getRow(firstRow);
585 this.removeRowClass(0, this.firstRowCls);
587 Ext.DomHelper.insertHtml('beforeBegin', before, html[0]);
588 before = this.getLockedRow(firstRow);
589 Ext.DomHelper.insertHtml('beforeBegin', before, html[1]);
591 this.removeRowClass(last - 1, this.lastRowCls);
592 Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html[0]);
593 Ext.DomHelper.insertHtml('beforeEnd', this.lockedBody.dom, html[1]);
596 this.fireEvent('rowsinserted', this, firstRow, lastRow);
597 this.processRows(firstRow);
598 }else if(firstRow === 0 || firstRow >= last){
599 this.addRowClass(firstRow, firstRow === 0 ? this.firstRowCls : this.lastRowCls);
602 this.syncFocusEl(firstRow);
605 getColumnStyle : function(col, isHeader){
606 var style = !isHeader ? this.cm.config[col].cellStyle || this.cm.config[col].css || '' : this.cm.config[col].headerStyle || '';
607 style += 'width:'+this.getColumnWidth(col)+';';
608 if(this.cm.isHidden(col)){
609 style += 'display:none;';
611 var align = this.cm.config[col].align;
613 style += 'text-align:'+align+';';
618 getLockedWidth : function() {
619 return this.cm.getTotalLockedWidth() + 'px';
622 getTotalWidth : function() {
623 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth()) + 'px';
626 getColumnData : function(){
627 var cs = [], cm = this.cm, colCount = cm.getColumnCount();
628 for(var i = 0; i < colCount; i++){
629 var name = cm.getDataIndex(i);
631 name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
632 renderer : cm.getRenderer(i),
633 id : cm.getColumnId(i),
634 style : this.getColumnStyle(i),
635 locked : cm.isLocked(i)
641 renderBody : function(){
642 var markup = this.renderRows() || [' ', ' '];
643 return [this.templates.body.apply({rows: markup[0]}), this.templates.body.apply({rows: markup[1]})];
646 refreshRow: function(record){
648 colCount = this.cm.getColumnCount(),
649 columns = this.getColumnData(),
651 cls = ['x-grid3-row'],
653 tstyle: String.format("width: {0};", this.getTotalWidth())
656 tstyle: String.format("width: {0};", this.getLockedWidth())
659 lockedColBuffer = [],
660 cellTpl = this.templates.cell,
669 if (Ext.isNumber(record)) {
671 record = store.getAt(rowIndex);
673 rowIndex = store.indexOf(record);
676 if (!record || rowIndex < 0) {
680 for (i = 0; i < colCount; i++) {
684 css = 'x-grid3-cell-first';
686 css = (i == last) ? 'x-grid3-cell-last ' : '';
697 meta.value = column.renderer.call(column.scope, record.data[column.name], meta, record, rowIndex, i, store);
699 if (Ext.isEmpty(meta.value)) {
703 if (this.markDirty && record.dirty && typeof record.modified[column.name] != 'undefined') {
704 meta.css += ' x-grid3-dirty-cell';
708 lockedColBuffer[i] = cellTpl.apply(meta);
710 colBuffer[i] = cellTpl.apply(meta);
714 row = this.getRow(rowIndex);
716 lockedRow = this.getLockedRow(rowIndex);
717 lockedRow.className = '';
719 if (this.grid.stripeRows && ((rowIndex + 1) % 2 === 0)) {
720 cls.push('x-grid3-row-alt');
723 if (this.getRowClass) {
724 rowParams.cols = colCount;
725 cls.push(this.getRowClass(record, rowIndex, rowParams, store));
729 this.fly(row).addClass(cls).setStyle(rowParams.tstyle);
730 rowParams.cells = colBuffer.join("");
731 row.innerHTML = this.templates.rowInner.apply(rowParams);
734 this.fly(lockedRow).addClass(cls).setStyle(lockedRowParams.tstyle);
735 lockedRowParams.cells = lockedColBuffer.join("");
736 lockedRow.innerHTML = this.templates.rowInner.apply(lockedRowParams);
737 lockedRow.rowIndex = rowIndex;
738 this.syncRowHeights(row, lockedRow);
739 this.fireEvent('rowupdated', this, rowIndex, record);
742 refresh : function(headersToo){
743 this.fireEvent('beforerefresh', this);
744 this.grid.stopEditing(true);
745 var result = this.renderBody();
746 this.mainBody.update(result[0]).setWidth(this.getTotalWidth());
747 this.lockedBody.update(result[1]).setWidth(this.getLockedWidth());
748 if(headersToo === true){
749 this.updateHeaders();
750 this.updateHeaderSortState();
752 this.processRows(0, true);
754 this.applyEmptyText();
755 this.fireEvent('refresh', this);
758 onDenyColumnLock : function(){
762 initData : function(ds, cm){
764 this.cm.un('columnlockchange', this.onColumnLock, this);
766 Ext.ux.grid.LockingGridView.superclass.initData.call(this, ds, cm);
768 this.cm.on('columnlockchange', this.onColumnLock, this);
772 onColumnLock : function(){
776 handleHdMenuClick : function(item){
777 var index = this.hdCtxIndex,
779 id = item.getItemId(),
780 llen = cm.getLockedCount();
783 if(cm.getColumnCount(true) <= llen + 1){
784 this.onDenyColumnLock();
787 cm.setLocked(index, true);
789 cm.moveColumn(index, llen);
790 this.grid.fireEvent('columnmove', index, llen);
794 if(llen - 1 != index){
795 cm.setLocked(index, false, true);
796 cm.moveColumn(index, llen - 1);
797 this.grid.fireEvent('columnmove', index, llen - 1);
799 cm.setLocked(index, false);
803 return Ext.ux.grid.LockingGridView.superclass.handleHdMenuClick.call(this, item);
808 handleHdDown : function(e, t){
809 Ext.ux.grid.LockingGridView.superclass.handleHdDown.call(this, e, t);
810 if(this.grid.enableColLock !== false){
811 if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
812 var hd = this.findHeaderCell(t),
813 index = this.getCellIndex(hd),
814 ms = this.hmenu.items, cm = this.cm;
815 ms.get('lock').setDisabled(cm.isLocked(index));
816 ms.get('unlock').setDisabled(!cm.isLocked(index));
821 syncHeaderHeight: function(){
822 var hrow = Ext.fly(this.innerHd).child('tr', true),
823 lhrow = Ext.fly(this.lockedInnerHd).child('tr', true);
825 hrow.style.height = 'auto';
826 lhrow.style.height = 'auto';
827 var hd = hrow.offsetHeight,
828 lhd = lhrow.offsetHeight,
829 height = Math.max(lhd, hd) + 'px';
831 hrow.style.height = height;
832 lhrow.style.height = height;
836 updateLockedWidth: function(){
837 var lw = this.cm.getTotalLockedWidth(),
838 tw = this.cm.getTotalWidth() - lw,
839 csize = this.grid.getGridEl().getSize(true),
840 lp = Ext.isBorderBox ? 0 : this.lockedBorderWidth,
841 rp = Ext.isBorderBox ? 0 : this.rowBorderWidth,
842 vw = (csize.width - lw - lp - rp) + 'px',
843 so = this.getScrollOffset();
844 if(!this.grid.autoHeight){
845 var vh = (csize.height - this.mainHd.getHeight()) + 'px';
846 this.lockedScroller.dom.style.height = vh;
847 this.scroller.dom.style.height = vh;
849 this.lockedWrap.dom.style.width = (lw + rp) + 'px';
850 this.scroller.dom.style.width = vw;
851 this.mainWrap.dom.style.left = (lw + lp + rp) + 'px';
853 this.lockedInnerHd.firstChild.style.width = lw + 'px';
854 this.lockedInnerHd.firstChild.firstChild.style.width = lw + 'px';
855 this.innerHd.style.width = vw;
856 this.innerHd.firstChild.style.width = (tw + rp + so) + 'px';
857 this.innerHd.firstChild.firstChild.style.width = tw + 'px';
860 this.lockedBody.dom.style.width = (lw + rp) + 'px';
861 this.mainBody.dom.style.width = (tw + rp) + 'px';
866 Ext.ux.grid.LockingColumnModel = Ext.extend(Ext.grid.ColumnModel, {
867 <div id="method-Ext.ux.grid.RowExpander-isLocked"></div>/**
868 * Returns true if the given column index is currently locked
869 * @param {Number} colIndex The column index
870 * @return {Boolean} True if the column is locked
872 isLocked : function(colIndex){
873 return this.config[colIndex].locked === true;
876 <div id="method-Ext.ux.grid.RowExpander-setLocked"></div>/**
877 * Locks or unlocks a given column
878 * @param {Number} colIndex The column index
879 * @param {Boolean} value True to lock, false to unlock
880 * @param {Boolean} suppressEvent Pass false to cause the columnlockchange event not to fire
882 setLocked : function(colIndex, value, suppressEvent){
883 if (this.isLocked(colIndex) == value) {
886 this.config[colIndex].locked = value;
887 if (!suppressEvent) {
888 this.fireEvent('columnlockchange', this, colIndex, value);
892 <div id="method-Ext.ux.grid.RowExpander-getTotalLockedWidth"></div>/**
893 * Returns the total width of all locked columns
894 * @return {Number} The width of all locked columns
896 getTotalLockedWidth : function(){
898 for (var i = 0, len = this.config.length; i < len; i++) {
899 if (this.isLocked(i) && !this.isHidden(i)) {
900 totalWidth += this.getColumnWidth(i);
907 <div id="method-Ext.ux.grid.RowExpander-getLockedCount"></div>/**
908 * Returns the total number of locked columns
909 * @return {Number} The number of locked columns
911 getLockedCount : function() {
912 var len = this.config.length;
914 for (var i = 0; i < len; i++) {
915 if (!this.isLocked(i)) {
920 //if we get to this point all of the columns are locked so we return the total
924 <div id="method-Ext.ux.grid.RowExpander-moveColumn"></div>/**
925 * Moves a column from one position to another
926 * @param {Number} oldIndex The current column index
927 * @param {Number} newIndex The destination column index
929 moveColumn : function(oldIndex, newIndex){
930 var oldLocked = this.isLocked(oldIndex),
931 newLocked = this.isLocked(newIndex);
933 if (oldIndex < newIndex && oldLocked && !newLocked) {
934 this.setLocked(oldIndex, false, true);
935 } else if (oldIndex > newIndex && !oldLocked && newLocked) {
936 this.setLocked(oldIndex, true, true);
939 Ext.ux.grid.LockingColumnModel.superclass.moveColumn.apply(this, arguments);