3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
9 Ext.ux.grid.LockingGridView = Ext.extend(Ext.grid.GridView, {
11 unlockText : 'Unlock',
13 lockedBorderWidth : 1,
16 * This option ensures that height between the rows is synchronized
17 * between the locked and unlocked sides. This option only needs to be used
18 * when the row heights aren't predictable.
22 initTemplates : function(){
23 var ts = this.templates || {};
26 ts.master = new Ext.Template(
27 '<div class="x-grid3" hidefocus="true">',
28 '<div class="x-grid3-locked">',
29 '<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>',
30 '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{lstyle}">{lockedBody}</div><div class="x-grid3-scroll-spacer"></div></div>',
32 '<div class="x-grid3-viewport x-grid3-unlocked">',
33 '<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>',
34 '<div class="x-grid3-scroller"><div class="x-grid3-body" style="{bstyle}">{body}</div><a href="#" class="x-grid3-focus" tabIndex="-1"></a></div>',
36 '<div class="x-grid3-resize-marker"> </div>',
37 '<div class="x-grid3-resize-proxy"> </div>',
44 Ext.ux.grid.LockingGridView.superclass.initTemplates.call(this);
47 getEditorParent : function(ed){
51 initElements : function(){
53 el = this.grid.getGridEl().dom.firstChild,
57 this.lockedWrap = new E(cs[0]);
58 this.lockedHd = new E(this.lockedWrap.dom.firstChild);
59 this.lockedInnerHd = this.lockedHd.dom.firstChild;
60 this.lockedScroller = new E(this.lockedWrap.dom.childNodes[1]);
61 this.lockedBody = new E(this.lockedScroller.dom.firstChild);
62 this.mainWrap = new E(cs[1]);
63 this.mainHd = new E(this.mainWrap.dom.firstChild);
65 if (this.grid.hideHeaders) {
66 this.lockedHd.setDisplayed(false);
67 this.mainHd.setDisplayed(false);
70 this.innerHd = this.mainHd.dom.firstChild;
71 this.scroller = new E(this.mainWrap.dom.childNodes[1]);
74 this.scroller.setStyle('overflow-x', 'hidden');
77 this.mainBody = new E(this.scroller.dom.firstChild);
78 this.focusEl = new E(this.scroller.dom.childNodes[1]);
79 this.resizeMarker = new E(cs[2]);
80 this.resizeProxy = new E(cs[3]);
82 this.focusEl.swallowEvent('click', true);
85 getLockedRows : function(){
86 return this.hasRows() ? this.lockedBody.dom.childNodes : [];
89 getLockedRow : function(row){
90 return this.getLockedRows()[row];
93 getCell : function(row, col){
94 var llen = this.cm.getLockedCount();
96 return this.getLockedRow(row).getElementsByTagName('td')[col];
98 return Ext.ux.grid.LockingGridView.superclass.getCell.call(this, row, col - llen);
101 getHeaderCell : function(index){
102 var llen = this.cm.getLockedCount();
104 return this.lockedHd.dom.getElementsByTagName('td')[index];
106 return Ext.ux.grid.LockingGridView.superclass.getHeaderCell.call(this, index - llen);
109 addRowClass : function(row, cls){
110 var r = this.getLockedRow(row);
112 this.fly(r).addClass(cls);
114 Ext.ux.grid.LockingGridView.superclass.addRowClass.call(this, row, cls);
117 removeRowClass : function(row, cls){
118 var r = this.getLockedRow(row);
120 this.fly(r).removeClass(cls);
122 Ext.ux.grid.LockingGridView.superclass.removeRowClass.call(this, row, cls);
125 removeRow : function(row) {
126 Ext.removeNode(this.getLockedRow(row));
127 Ext.ux.grid.LockingGridView.superclass.removeRow.call(this, row);
130 removeRows : function(firstRow, lastRow){
131 var bd = this.lockedBody.dom;
132 for(var rowIndex = firstRow; rowIndex <= lastRow; rowIndex++){
133 Ext.removeNode(bd.childNodes[firstRow]);
135 Ext.ux.grid.LockingGridView.superclass.removeRows.call(this, firstRow, lastRow);
138 syncScroll : function(e){
139 var mb = this.scroller.dom;
140 this.lockedScroller.dom.scrollTop = mb.scrollTop;
141 Ext.ux.grid.LockingGridView.superclass.syncScroll.call(this, e);
144 updateSortIcon : function(col, dir){
145 var sc = this.sortClasses,
146 lhds = this.lockedHd.select('td').removeClass(sc),
147 hds = this.mainHd.select('td').removeClass(sc),
148 llen = this.cm.getLockedCount(),
149 cls = sc[dir == 'DESC' ? 1 : 0];
151 lhds.item(col).addClass(cls);
153 hds.item(col - llen).addClass(cls);
157 updateAllColumnWidths : function(){
158 var tw = this.getTotalWidth(),
159 clen = this.cm.getColumnCount(),
160 lw = this.getLockedWidth(),
161 llen = this.cm.getLockedCount(),
163 this.updateLockedWidth();
164 for(i = 0; i < clen; i++){
165 ws[i] = this.getColumnWidth(i);
166 var hd = this.getHeaderCell(i);
167 hd.style.width = ws[i];
169 var lns = this.getLockedRows(), ns = this.getRows(), row, trow, j;
170 for(i = 0, len = ns.length; i < len; i++){
172 row.style.width = lw;
174 row.firstChild.style.width = lw;
175 trow = row.firstChild.rows[0];
176 for (j = 0; j < llen; j++) {
177 trow.childNodes[j].style.width = ws[j];
181 row.style.width = tw;
183 row.firstChild.style.width = tw;
184 trow = row.firstChild.rows[0];
185 for (j = llen; j < clen; j++) {
186 trow.childNodes[j - llen].style.width = ws[j];
190 this.onAllColumnWidthsUpdated(ws, tw);
191 this.syncHeaderHeight();
194 updateColumnWidth : function(col, width){
195 var w = this.getColumnWidth(col),
196 llen = this.cm.getLockedCount(),
198 this.updateLockedWidth();
200 ns = this.getLockedRows();
201 rw = this.getLockedWidth();
205 rw = this.getTotalWidth();
208 var hd = this.getHeaderCell(col);
210 for(var i = 0, len = ns.length; i < len; i++){
212 row.style.width = rw;
214 row.firstChild.style.width = rw;
215 row.firstChild.rows[0].childNodes[c].style.width = w;
218 this.onColumnWidthUpdated(col, w, this.getTotalWidth());
219 this.syncHeaderHeight();
222 updateColumnHidden : function(col, hidden){
223 var llen = this.cm.getLockedCount(),
225 display = hidden ? 'none' : '';
226 this.updateLockedWidth();
228 ns = this.getLockedRows();
229 rw = this.getLockedWidth();
233 rw = this.getTotalWidth();
236 var hd = this.getHeaderCell(col);
237 hd.style.display = display;
238 for(var i = 0, len = ns.length; i < len; i++){
240 row.style.width = rw;
242 row.firstChild.style.width = rw;
243 row.firstChild.rows[0].childNodes[c].style.display = display;
246 this.onColumnHiddenUpdated(col, hidden, this.getTotalWidth());
247 delete this.lastViewWidth;
251 doRender : function(cs, rs, ds, startRow, colCount, stripe){
252 var ts = this.templates, ct = ts.cell, rt = ts.row, last = colCount-1,
253 tstyle = 'width:'+this.getTotalWidth()+';',
254 lstyle = 'width:'+this.getLockedWidth()+';',
255 buf = [], lbuf = [], cb, lcb, c, p = {}, rp = {}, r;
256 for(var j = 0, len = rs.length; j < len; j++){
257 r = rs[j]; cb = []; lcb = [];
258 var rowIndex = (j+startRow);
259 for(var i = 0; i < colCount; i++){
262 p.css = (i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '')) +
263 (this.cm.config[i].cellCls ? ' ' + this.cm.config[i].cellCls : '');
264 p.attr = p.cellAttr = '';
265 p.value = c.renderer(r.data[c.name], p, r, rowIndex, i, ds);
267 if(Ext.isEmpty(p.value)){
270 if(this.markDirty && r.dirty && Ext.isDefined(r.modified[c.name])){
271 p.css += ' x-grid3-dirty-cell';
274 lcb[lcb.length] = ct.apply(p);
276 cb[cb.length] = ct.apply(p);
280 if(stripe && ((rowIndex+1) % 2 === 0)){
281 alt[0] = 'x-grid3-row-alt';
284 alt[1] = ' x-grid3-dirty-row';
287 if(this.getRowClass){
288 alt[2] = this.getRowClass(r, rowIndex, rp, ds);
290 rp.alt = alt.join(' ');
291 rp.cells = cb.join('');
293 buf[buf.length] = rt.apply(rp);
294 rp.cells = lcb.join('');
296 lbuf[lbuf.length] = rt.apply(rp);
298 return [buf.join(''), lbuf.join('')];
300 processRows : function(startRow, skipStripe){
301 if(!this.ds || this.ds.getCount() < 1){
304 var rows = this.getRows(),
305 lrows = this.getLockedRows(),
307 skipStripe = skipStripe || !this.grid.stripeRows;
308 startRow = startRow || 0;
309 for(var i = 0, len = rows.length; i < len; ++i){
315 row.className = row.className.replace(this.rowClsRe, ' ');
316 lrow.className = lrow.className.replace(this.rowClsRe, ' ');
317 if ((i + 1) % 2 === 0){
318 row.className += ' x-grid3-row-alt';
319 lrow.className += ' x-grid3-row-alt';
322 if(this.syncHeights){
323 var el1 = Ext.get(row),
325 h1 = el1.getHeight(),
326 h2 = el2.getHeight();
336 Ext.fly(rows[0]).addClass(this.firstRowCls);
337 Ext.fly(lrows[0]).addClass(this.firstRowCls);
339 Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls);
340 Ext.fly(lrows[lrows.length - 1]).addClass(this.lastRowCls);
343 afterRender : function(){
344 if(!this.ds || !this.cm){
347 var bd = this.renderRows() || [' ', ' '];
348 this.mainBody.dom.innerHTML = bd[0];
349 this.lockedBody.dom.innerHTML = bd[1];
350 this.processRows(0, true);
351 if(this.deferEmptyText !== true){
352 this.applyEmptyText();
354 this.grid.fireEvent('viewready', this.grid);
357 renderUI : function(){
358 var header = this.renderHeaders();
359 var body = this.templates.body.apply({rows:' '});
360 var html = this.templates.master.apply({
363 ostyle: 'width:'+this.getOffsetWidth()+';',
364 bstyle: 'width:'+this.getTotalWidth()+';',
366 lockedHeader: header[1],
367 lstyle: 'width:'+this.getLockedWidth()+';'
370 g.getGridEl().dom.innerHTML = html;
372 Ext.fly(this.innerHd).on('click', this.handleHdDown, this);
373 Ext.fly(this.lockedInnerHd).on('click', this.handleHdDown, this);
376 mouseover: this.handleHdOver,
377 mouseout: this.handleHdOut,
378 mousemove: this.handleHdMove
382 mouseover: this.handleHdOver,
383 mouseout: this.handleHdOut,
384 mousemove: this.handleHdMove
386 this.scroller.on('scroll', this.syncScroll, this);
387 if(g.enableColumnResize !== false){
388 this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
389 this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom));
390 this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom));
392 if(g.enableColumnMove){
393 this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
394 this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd));
395 this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd));
396 this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
398 if(g.enableHdMenu !== false){
399 this.hmenu = new Ext.menu.Menu({id: g.id + '-hctx'});
401 {itemId: 'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'},
402 {itemId: 'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'}
404 if(this.grid.enableColLock !== false){
406 {itemId: 'lock', text: this.lockText, cls: 'xg-hmenu-lock'},
407 {itemId: 'unlock', text: this.unlockText, cls: 'xg-hmenu-unlock'}
410 if(g.enableColumnHide !== false){
411 this.colMenu = new Ext.menu.Menu({id:g.id + '-hcols-menu'});
414 beforeshow: this.beforeColMenuShow,
415 itemclick: this.handleHdMenuClick
417 this.hmenu.add('-', {
420 text: this.columnsText,
422 iconCls: 'x-cols-icon'
425 this.hmenu.on('itemclick', this.handleHdMenuClick, this);
427 if(g.trackMouseOver){
430 mouseover: this.onRowOver,
431 mouseout: this.onRowOut
435 mouseover: this.onRowOver,
436 mouseout: this.onRowOut
440 if(g.enableDragDrop || g.enableDrag){
441 this.dragZone = new Ext.grid.GridDragZone(g, {
442 ddGroup : g.ddGroup || 'GridDD'
445 this.updateHeaderSortState();
453 var c = g.getGridEl();
454 var csize = c.getSize(true);
455 var vw = csize.width;
456 if(!g.hideHeaders && (vw < 20 || csize.height < 20)){
459 this.syncHeaderHeight();
461 this.scroller.dom.style.overflow = 'visible';
462 this.lockedScroller.dom.style.overflow = 'visible';
464 this.scroller.dom.style.position = 'static';
465 this.lockedScroller.dom.style.position = 'static';
468 this.el.setSize(csize.width, csize.height);
469 var hdHeight = this.mainHd.getHeight();
470 var vh = csize.height - (hdHeight);
472 this.updateLockedWidth();
474 if(this.lastViewWidth != vw){
475 this.fitColumns(false, false);
476 this.lastViewWidth = vw;
480 this.syncHeaderScroll();
482 this.onLayout(vw, vh);
485 getOffsetWidth : function() {
486 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth() + this.getScrollOffset()) + 'px';
489 renderHeaders : function(){
495 len = cm.getColumnCount(),
497 for(var i = 0; i < len; i++){
498 p.id = cm.getColumnId(i);
499 p.value = cm.getColumnHeader(i) || '';
500 p.style = this.getColumnStyle(i, true);
501 p.tooltip = this.getColumnTooltip(i);
502 p.css = (i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '')) +
503 (cm.config[i].headerCls ? ' ' + cm.config[i].headerCls : '');
504 if(cm.config[i].align == 'right'){
505 p.istyle = 'padding-right:16px';
510 lcb[lcb.length] = ct.apply(p);
512 cb[cb.length] = ct.apply(p);
515 return [ts.header.apply({cells: cb.join(''), tstyle:'width:'+this.getTotalWidth()+';'}),
516 ts.header.apply({cells: lcb.join(''), tstyle:'width:'+this.getLockedWidth()+';'})];
519 updateHeaders : function(){
520 var hd = this.renderHeaders();
521 this.innerHd.firstChild.innerHTML = hd[0];
522 this.innerHd.firstChild.style.width = this.getOffsetWidth();
523 this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth();
524 this.lockedInnerHd.firstChild.innerHTML = hd[1];
525 var lw = this.getLockedWidth();
526 this.lockedInnerHd.firstChild.style.width = lw;
527 this.lockedInnerHd.firstChild.firstChild.style.width = lw;
530 getResolvedXY : function(resolved){
534 var c = resolved.cell, r = resolved.row;
535 return c ? Ext.fly(c).getXY() : [this.scroller.getX(), Ext.fly(r).getY()];
538 syncFocusEl : function(row, col, hscroll){
539 Ext.ux.grid.LockingGridView.superclass.syncFocusEl.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
542 ensureVisible : function(row, col, hscroll){
543 return Ext.ux.grid.LockingGridView.superclass.ensureVisible.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
546 insertRows : function(dm, firstRow, lastRow, isUpdate){
547 var last = dm.getCount() - 1;
548 if(!isUpdate && firstRow === 0 && lastRow >= last){
552 this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
554 var html = this.renderRows(firstRow, lastRow),
555 before = this.getRow(firstRow);
558 this.removeRowClass(0, this.firstRowCls);
560 Ext.DomHelper.insertHtml('beforeBegin', before, html[0]);
561 before = this.getLockedRow(firstRow);
562 Ext.DomHelper.insertHtml('beforeBegin', before, html[1]);
564 this.removeRowClass(last - 1, this.lastRowCls);
565 Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html[0]);
566 Ext.DomHelper.insertHtml('beforeEnd', this.lockedBody.dom, html[1]);
569 this.fireEvent('rowsinserted', this, firstRow, lastRow);
570 this.processRows(firstRow);
571 }else if(firstRow === 0 || firstRow >= last){
572 this.addRowClass(firstRow, firstRow === 0 ? this.firstRowCls : this.lastRowCls);
575 this.syncFocusEl(firstRow);
578 getColumnStyle : function(col, isHeader){
579 var style = !isHeader ? this.cm.config[col].cellStyle || this.cm.config[col].css || '' : this.cm.config[col].headerStyle || '';
580 style += 'width:'+this.getColumnWidth(col)+';';
581 if(this.cm.isHidden(col)){
582 style += 'display:none;';
584 var align = this.cm.config[col].align;
586 style += 'text-align:'+align+';';
591 getLockedWidth : function() {
592 return this.cm.getTotalLockedWidth() + 'px';
595 getTotalWidth : function() {
596 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth()) + 'px';
599 getColumnData : function(){
600 var cs = [], cm = this.cm, colCount = cm.getColumnCount();
601 for(var i = 0; i < colCount; i++){
602 var name = cm.getDataIndex(i);
604 name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
605 renderer : cm.getRenderer(i),
606 id : cm.getColumnId(i),
607 style : this.getColumnStyle(i),
608 locked : cm.isLocked(i)
614 renderBody : function(){
615 var markup = this.renderRows() || [' ', ' '];
616 return [this.templates.body.apply({rows: markup[0]}), this.templates.body.apply({rows: markup[1]})];
619 refreshRow : function(record){
620 Ext.ux.grid.LockingGridView.superclass.refreshRow.call(this, record);
621 var index = Ext.isNumber(record) ? record : this.ds.indexOf(record);
622 this.getLockedRow(index).rowIndex = index;
625 refresh : function(headersToo){
626 this.fireEvent('beforerefresh', this);
627 this.grid.stopEditing(true);
628 var result = this.renderBody();
629 this.mainBody.update(result[0]).setWidth(this.getTotalWidth());
630 this.lockedBody.update(result[1]).setWidth(this.getLockedWidth());
631 if(headersToo === true){
632 this.updateHeaders();
633 this.updateHeaderSortState();
635 this.processRows(0, true);
637 this.applyEmptyText();
638 this.fireEvent('refresh', this);
641 onDenyColumnLock : function(){
645 initData : function(ds, cm){
647 this.cm.un('columnlockchange', this.onColumnLock, this);
649 Ext.ux.grid.LockingGridView.superclass.initData.call(this, ds, cm);
651 this.cm.on('columnlockchange', this.onColumnLock, this);
655 onColumnLock : function(){
659 handleHdMenuClick : function(item){
660 var index = this.hdCtxIndex,
662 id = item.getItemId(),
663 llen = cm.getLockedCount();
666 if(cm.getColumnCount(true) <= llen + 1){
667 this.onDenyColumnLock();
670 cm.setLocked(index, true);
672 cm.moveColumn(index, llen);
673 this.grid.fireEvent('columnmove', index, llen);
677 if(llen - 1 != index){
678 cm.setLocked(index, false, true);
679 cm.moveColumn(index, llen - 1);
680 this.grid.fireEvent('columnmove', index, llen - 1);
682 cm.setLocked(index, false);
686 return Ext.ux.grid.LockingGridView.superclass.handleHdMenuClick.call(this, item);
691 handleHdDown : function(e, t){
692 Ext.ux.grid.LockingGridView.superclass.handleHdDown.call(this, e, t);
693 if(this.grid.enableColLock !== false){
694 if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
695 var hd = this.findHeaderCell(t),
696 index = this.getCellIndex(hd),
697 ms = this.hmenu.items, cm = this.cm;
698 ms.get('lock').setDisabled(cm.isLocked(index));
699 ms.get('unlock').setDisabled(!cm.isLocked(index));
704 syncHeaderHeight: function(){
705 this.innerHd.firstChild.firstChild.style.height = 'auto';
706 this.lockedInnerHd.firstChild.firstChild.style.height = 'auto';
707 var hd = this.innerHd.firstChild.firstChild.offsetHeight,
708 lhd = this.lockedInnerHd.firstChild.firstChild.offsetHeight,
709 height = (lhd > hd ? lhd : hd) + 'px';
710 this.innerHd.firstChild.firstChild.style.height = height;
711 this.lockedInnerHd.firstChild.firstChild.style.height = height;
714 updateLockedWidth: function(){
715 var lw = this.cm.getTotalLockedWidth(),
716 tw = this.cm.getTotalWidth() - lw,
717 csize = this.grid.getGridEl().getSize(true),
718 lp = Ext.isBorderBox ? 0 : this.lockedBorderWidth,
719 rp = Ext.isBorderBox ? 0 : this.rowBorderWidth,
720 vw = (csize.width - lw - lp - rp) + 'px',
721 so = this.getScrollOffset();
722 if(!this.grid.autoHeight){
723 var vh = (csize.height - this.mainHd.getHeight()) + 'px';
724 this.lockedScroller.dom.style.height = vh;
725 this.scroller.dom.style.height = vh;
727 this.lockedWrap.dom.style.width = (lw + rp) + 'px';
728 this.scroller.dom.style.width = vw;
729 this.mainWrap.dom.style.left = (lw + lp + rp) + 'px';
731 this.lockedInnerHd.firstChild.style.width = lw + 'px';
732 this.lockedInnerHd.firstChild.firstChild.style.width = lw + 'px';
733 this.innerHd.style.width = vw;
734 this.innerHd.firstChild.style.width = (tw + rp + so) + 'px';
735 this.innerHd.firstChild.firstChild.style.width = tw + 'px';
738 this.lockedBody.dom.style.width = (lw + rp) + 'px';
739 this.mainBody.dom.style.width = (tw + rp) + 'px';
744 Ext.ux.grid.LockingColumnModel = Ext.extend(Ext.grid.ColumnModel, {
746 * Returns true if the given column index is currently locked
747 * @param {Number} colIndex The column index
748 * @return {Boolean} True if the column is locked
750 isLocked : function(colIndex){
751 return this.config[colIndex].locked === true;
755 * Locks or unlocks a given column
756 * @param {Number} colIndex The column index
757 * @param {Boolean} value True to lock, false to unlock
758 * @param {Boolean} suppressEvent Pass false to cause the columnlockchange event not to fire
760 setLocked : function(colIndex, value, suppressEvent){
761 if (this.isLocked(colIndex) == value) {
764 this.config[colIndex].locked = value;
765 if (!suppressEvent) {
766 this.fireEvent('columnlockchange', this, colIndex, value);
771 * Returns the total width of all locked columns
772 * @return {Number} The width of all locked columns
774 getTotalLockedWidth : function(){
776 for (var i = 0, len = this.config.length; i < len; i++) {
777 if (this.isLocked(i) && !this.isHidden(i)) {
778 totalWidth += this.getColumnWidth(i);
786 * Returns the total number of locked columns
787 * @return {Number} The number of locked columns
789 getLockedCount : function() {
790 var len = this.config.length;
792 for (var i = 0; i < len; i++) {
793 if (!this.isLocked(i)) {
798 //if we get to this point all of the columns are locked so we return the total
803 * Moves a column from one position to another
804 * @param {Number} oldIndex The current column index
805 * @param {Number} newIndex The destination column index
807 moveColumn : function(oldIndex, newIndex){
808 var oldLocked = this.isLocked(oldIndex),
809 newLocked = this.isLocked(newIndex);
811 if (oldIndex < newIndex && oldLocked && !newLocked) {
812 this.setLocked(oldIndex, false, true);
813 } else if (oldIndex > newIndex && !oldLocked && newLocked) {
814 this.setLocked(oldIndex, true, true);
817 Ext.ux.grid.LockingColumnModel.superclass.moveColumn.apply(this, arguments);