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();
356 renderUI : function(){
357 var header = this.renderHeaders();
358 var body = this.templates.body.apply({rows:' '});
359 var html = this.templates.master.apply({
362 ostyle: 'width:'+this.getOffsetWidth()+';',
363 bstyle: 'width:'+this.getTotalWidth()+';',
365 lockedHeader: header[1],
366 lstyle: 'width:'+this.getLockedWidth()+';'
369 g.getGridEl().dom.innerHTML = html;
371 Ext.fly(this.innerHd).on('click', this.handleHdDown, this);
372 Ext.fly(this.lockedInnerHd).on('click', this.handleHdDown, this);
375 mouseover: this.handleHdOver,
376 mouseout: this.handleHdOut,
377 mousemove: this.handleHdMove
381 mouseover: this.handleHdOver,
382 mouseout: this.handleHdOut,
383 mousemove: this.handleHdMove
385 this.scroller.on('scroll', this.syncScroll, this);
386 if(g.enableColumnResize !== false){
387 this.splitZone = new Ext.grid.GridView.SplitDragZone(g, this.mainHd.dom);
388 this.splitZone.setOuterHandleElId(Ext.id(this.lockedHd.dom));
389 this.splitZone.setOuterHandleElId(Ext.id(this.mainHd.dom));
391 if(g.enableColumnMove){
392 this.columnDrag = new Ext.grid.GridView.ColumnDragZone(g, this.innerHd);
393 this.columnDrag.setOuterHandleElId(Ext.id(this.lockedInnerHd));
394 this.columnDrag.setOuterHandleElId(Ext.id(this.innerHd));
395 this.columnDrop = new Ext.grid.HeaderDropZone(g, this.mainHd.dom);
397 if(g.enableHdMenu !== false){
398 this.hmenu = new Ext.menu.Menu({id: g.id + '-hctx'});
400 {itemId: 'asc', text: this.sortAscText, cls: 'xg-hmenu-sort-asc'},
401 {itemId: 'desc', text: this.sortDescText, cls: 'xg-hmenu-sort-desc'}
403 if(this.grid.enableColLock !== false){
405 {itemId: 'lock', text: this.lockText, cls: 'xg-hmenu-lock'},
406 {itemId: 'unlock', text: this.unlockText, cls: 'xg-hmenu-unlock'}
409 if(g.enableColumnHide !== false){
410 this.colMenu = new Ext.menu.Menu({id:g.id + '-hcols-menu'});
413 beforeshow: this.beforeColMenuShow,
414 itemclick: this.handleHdMenuClick
416 this.hmenu.add('-', {
419 text: this.columnsText,
421 iconCls: 'x-cols-icon'
424 this.hmenu.on('itemclick', this.handleHdMenuClick, this);
426 if(g.trackMouseOver){
429 mouseover: this.onRowOver,
430 mouseout: this.onRowOut
434 mouseover: this.onRowOver,
435 mouseout: this.onRowOut
439 if(g.enableDragDrop || g.enableDrag){
440 this.dragZone = new Ext.grid.GridDragZone(g, {
441 ddGroup : g.ddGroup || 'GridDD'
444 this.updateHeaderSortState();
452 var c = g.getGridEl();
453 var csize = c.getSize(true);
454 var vw = csize.width;
455 if(!g.hideHeaders && (vw < 20 || csize.height < 20)){
458 this.syncHeaderHeight();
460 this.scroller.dom.style.overflow = 'visible';
461 this.lockedScroller.dom.style.overflow = 'visible';
463 this.scroller.dom.style.position = 'static';
464 this.lockedScroller.dom.style.position = 'static';
467 this.el.setSize(csize.width, csize.height);
468 var hdHeight = this.mainHd.getHeight();
469 var vh = csize.height - (hdHeight);
471 this.updateLockedWidth();
473 if(this.lastViewWidth != vw){
474 this.fitColumns(false, false);
475 this.lastViewWidth = vw;
479 this.syncHeaderScroll();
481 this.onLayout(vw, vh);
484 getOffsetWidth : function() {
485 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth() + this.getScrollOffset()) + 'px';
488 renderHeaders : function(){
494 len = cm.getColumnCount(),
496 for(var i = 0; i < len; i++){
497 p.id = cm.getColumnId(i);
498 p.value = cm.getColumnHeader(i) || '';
499 p.style = this.getColumnStyle(i, true);
500 p.tooltip = this.getColumnTooltip(i);
501 p.css = (i === 0 ? 'x-grid3-cell-first ' : (i == last ? 'x-grid3-cell-last ' : '')) +
502 (cm.config[i].headerCls ? ' ' + cm.config[i].headerCls : '');
503 if(cm.config[i].align == 'right'){
504 p.istyle = 'padding-right:16px';
509 lcb[lcb.length] = ct.apply(p);
511 cb[cb.length] = ct.apply(p);
514 return [ts.header.apply({cells: cb.join(''), tstyle:'width:'+this.getTotalWidth()+';'}),
515 ts.header.apply({cells: lcb.join(''), tstyle:'width:'+this.getLockedWidth()+';'})];
518 updateHeaders : function(){
519 var hd = this.renderHeaders();
520 this.innerHd.firstChild.innerHTML = hd[0];
521 this.innerHd.firstChild.style.width = this.getOffsetWidth();
522 this.innerHd.firstChild.firstChild.style.width = this.getTotalWidth();
523 this.lockedInnerHd.firstChild.innerHTML = hd[1];
524 var lw = this.getLockedWidth();
525 this.lockedInnerHd.firstChild.style.width = lw;
526 this.lockedInnerHd.firstChild.firstChild.style.width = lw;
529 getResolvedXY : function(resolved){
533 var c = resolved.cell, r = resolved.row;
534 return c ? Ext.fly(c).getXY() : [this.scroller.getX(), Ext.fly(r).getY()];
537 syncFocusEl : function(row, col, hscroll){
538 Ext.ux.grid.LockingGridView.superclass.syncFocusEl.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
541 ensureVisible : function(row, col, hscroll){
542 return Ext.ux.grid.LockingGridView.superclass.ensureVisible.call(this, row, col, col < this.cm.getLockedCount() ? false : hscroll);
545 insertRows : function(dm, firstRow, lastRow, isUpdate){
546 var last = dm.getCount() - 1;
547 if(!isUpdate && firstRow === 0 && lastRow >= last){
551 this.fireEvent('beforerowsinserted', this, firstRow, lastRow);
553 var html = this.renderRows(firstRow, lastRow),
554 before = this.getRow(firstRow);
557 this.removeRowClass(0, this.firstRowCls);
559 Ext.DomHelper.insertHtml('beforeBegin', before, html[0]);
560 before = this.getLockedRow(firstRow);
561 Ext.DomHelper.insertHtml('beforeBegin', before, html[1]);
563 this.removeRowClass(last - 1, this.lastRowCls);
564 Ext.DomHelper.insertHtml('beforeEnd', this.mainBody.dom, html[0]);
565 Ext.DomHelper.insertHtml('beforeEnd', this.lockedBody.dom, html[1]);
568 this.fireEvent('rowsinserted', this, firstRow, lastRow);
569 this.processRows(firstRow);
570 }else if(firstRow === 0 || firstRow >= last){
571 this.addRowClass(firstRow, firstRow === 0 ? this.firstRowCls : this.lastRowCls);
574 this.syncFocusEl(firstRow);
577 getColumnStyle : function(col, isHeader){
578 var style = !isHeader ? this.cm.config[col].cellStyle || this.cm.config[col].css || '' : this.cm.config[col].headerStyle || '';
579 style += 'width:'+this.getColumnWidth(col)+';';
580 if(this.cm.isHidden(col)){
581 style += 'display:none;';
583 var align = this.cm.config[col].align;
585 style += 'text-align:'+align+';';
590 getLockedWidth : function() {
591 return this.cm.getTotalLockedWidth() + 'px';
594 getTotalWidth : function() {
595 return (this.cm.getTotalWidth() - this.cm.getTotalLockedWidth()) + 'px';
598 getColumnData : function(){
599 var cs = [], cm = this.cm, colCount = cm.getColumnCount();
600 for(var i = 0; i < colCount; i++){
601 var name = cm.getDataIndex(i);
603 name : (!Ext.isDefined(name) ? this.ds.fields.get(i).name : name),
604 renderer : cm.getRenderer(i),
605 id : cm.getColumnId(i),
606 style : this.getColumnStyle(i),
607 locked : cm.isLocked(i)
613 renderBody : function(){
614 var markup = this.renderRows() || [' ', ' '];
615 return [this.templates.body.apply({rows: markup[0]}), this.templates.body.apply({rows: markup[1]})];
618 refreshRow : function(record){
619 Ext.ux.grid.LockingGridView.superclass.refreshRow.call(this, record);
620 var index = Ext.isNumber(record) ? record : this.ds.indexOf(record);
621 this.getLockedRow(index).rowIndex = index;
624 refresh : function(headersToo){
625 this.fireEvent('beforerefresh', this);
626 this.grid.stopEditing(true);
627 var result = this.renderBody();
628 this.mainBody.update(result[0]).setWidth(this.getTotalWidth());
629 this.lockedBody.update(result[1]).setWidth(this.getLockedWidth());
630 if(headersToo === true){
631 this.updateHeaders();
632 this.updateHeaderSortState();
634 this.processRows(0, true);
636 this.applyEmptyText();
637 this.fireEvent('refresh', this);
640 onDenyColumnLock : function(){
644 initData : function(ds, cm){
646 this.cm.un('columnlockchange', this.onColumnLock, this);
648 Ext.ux.grid.LockingGridView.superclass.initData.call(this, ds, cm);
650 this.cm.on('columnlockchange', this.onColumnLock, this);
654 onColumnLock : function(){
658 handleHdMenuClick : function(item){
659 var index = this.hdCtxIndex,
661 id = item.getItemId(),
662 llen = cm.getLockedCount();
665 if(cm.getColumnCount(true) <= llen + 1){
666 this.onDenyColumnLock();
670 cm.setLocked(index, true, true);
671 cm.moveColumn(index, llen);
672 this.grid.fireEvent('columnmove', index, llen);
674 cm.setLocked(index, true);
678 if(llen - 1 != index){
679 cm.setLocked(index, false, true);
680 cm.moveColumn(index, llen - 1);
681 this.grid.fireEvent('columnmove', index, llen - 1);
683 cm.setLocked(index, false);
687 return Ext.ux.grid.LockingGridView.superclass.handleHdMenuClick.call(this, item);
692 handleHdDown : function(e, t){
693 Ext.ux.grid.LockingGridView.superclass.handleHdDown.call(this, e, t);
694 if(this.grid.enableColLock !== false){
695 if(Ext.fly(t).hasClass('x-grid3-hd-btn')){
696 var hd = this.findHeaderCell(t),
697 index = this.getCellIndex(hd),
698 ms = this.hmenu.items, cm = this.cm;
699 ms.get('lock').setDisabled(cm.isLocked(index));
700 ms.get('unlock').setDisabled(!cm.isLocked(index));
705 syncHeaderHeight: function(){
706 this.innerHd.firstChild.firstChild.style.height = 'auto';
707 this.lockedInnerHd.firstChild.firstChild.style.height = 'auto';
708 var hd = this.innerHd.firstChild.firstChild.offsetHeight,
709 lhd = this.lockedInnerHd.firstChild.firstChild.offsetHeight,
710 height = (lhd > hd ? lhd : hd) + 'px';
711 this.innerHd.firstChild.firstChild.style.height = height;
712 this.lockedInnerHd.firstChild.firstChild.style.height = height;
715 updateLockedWidth: function(){
716 var lw = this.cm.getTotalLockedWidth(),
717 tw = this.cm.getTotalWidth() - lw,
718 csize = this.grid.getGridEl().getSize(true),
719 lp = Ext.isBorderBox ? 0 : this.lockedBorderWidth,
720 rp = Ext.isBorderBox ? 0 : this.rowBorderWidth,
721 vw = (csize.width - lw - lp - rp) + 'px',
722 so = this.getScrollOffset();
723 if(!this.grid.autoHeight){
724 var vh = (csize.height - this.mainHd.getHeight()) + 'px';
725 this.lockedScroller.dom.style.height = vh;
726 this.scroller.dom.style.height = vh;
728 this.lockedWrap.dom.style.width = (lw + rp) + 'px';
729 this.scroller.dom.style.width = vw;
730 this.mainWrap.dom.style.left = (lw + lp + rp) + 'px';
732 this.lockedInnerHd.firstChild.style.width = lw + 'px';
733 this.lockedInnerHd.firstChild.firstChild.style.width = lw + 'px';
734 this.innerHd.style.width = vw;
735 this.innerHd.firstChild.style.width = (tw + rp + so) + 'px';
736 this.innerHd.firstChild.firstChild.style.width = tw + 'px';
739 this.lockedBody.dom.style.width = (lw + rp) + 'px';
740 this.mainBody.dom.style.width = (tw + rp) + 'px';
745 Ext.ux.grid.LockingColumnModel = Ext.extend(Ext.grid.ColumnModel, {
747 * Returns true if the given column index is currently locked
748 * @param {Number} colIndex The column index
749 * @return {Boolean} True if the column is locked
751 isLocked : function(colIndex){
752 return this.config[colIndex].locked === true;
756 * Locks or unlocks a given column
757 * @param {Number} colIndex The column index
758 * @param {Boolean} value True to lock, false to unlock
759 * @param {Boolean} suppressEvent Pass false to cause the columnlockchange event not to fire
761 setLocked : function(colIndex, value, suppressEvent){
762 if (this.isLocked(colIndex) == value) {
765 this.config[colIndex].locked = value;
766 if (!suppressEvent) {
767 this.fireEvent('columnlockchange', this, colIndex, value);
772 * Returns the total width of all locked columns
773 * @return {Number} The width of all locked columns
775 getTotalLockedWidth : function(){
777 for (var i = 0, len = this.config.length; i < len; i++) {
778 if (this.isLocked(i) && !this.isHidden(i)) {
779 totalWidth += this.getColumnWidth(i);
787 * Returns the total number of locked columns
788 * @return {Number} The number of locked columns
790 getLockedCount : function() {
791 var len = this.config.length;
793 for (var i = 0; i < len; i++) {
794 if (!this.isLocked(i)) {
799 //if we get to this point all of the columns are locked so we return the total
804 * Moves a column from one position to another
805 * @param {Number} oldIndex The current column index
806 * @param {Number} newIndex The destination column index
808 moveColumn : function(oldIndex, newIndex){
809 var oldLocked = this.isLocked(oldIndex),
810 newLocked = this.isLocked(newIndex);
812 if (oldIndex < newIndex && oldLocked && !newLocked) {
813 this.setLocked(oldIndex, false, true);
814 } else if (oldIndex > newIndex && !oldLocked && newLocked) {
815 this.setLocked(oldIndex, true, true);
818 Ext.ux.grid.LockingColumnModel.superclass.moveColumn.apply(this, arguments);