Show
Ignore:
Timestamp:
07/09/09 14:55:22 (3 years ago)
Author:
tsuckow
Message:
  • enhancement: added Ext 3.0.0 compatibility
  • fixed: (GridView?.js) listener "onBeforeLoad()" now aborts any ongoing server request and properly resets properties "isBuffering" and "isPreBuffering"
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/Ext3.0/trunk/src/GridView.js

    r55 r57  
    354354                this.loadMask.msg, this.loadMask.msgCls 
    355355            ); 
    356             this._loadMaskAnchor._mask.addClass('ext-ux-livegrid'); 
    357             this._loadMaskAnchor._mask.setDisplayed(false); 
    358             this._loadMaskAnchor._maskMsg.setDisplayed(false); 
     356            var dom  = this._loadMaskAnchor.dom; 
     357            var data = Ext.Element.data; 
     358            data(dom, 'mask').addClass('ext-ux-livegrid'); 
     359            data(dom, 'mask').setDisplayed(false); 
     360            data(dom, 'maskMsg').setDisplayed(false); 
    359361        } 
    360362    }, 
     
    489491        var vw = csize.width; 
    490492 
    491         if(vw < 20 || csize.height < 20){ // display: none? 
     493        if(!g.hideHeaders && vw < 20 || csize.height < 20){ // display: none? 
    492494            return; 
    493495        } 
     
    574576        this.updateHeaderSortState(); 
    575577        this.afterMove(newIndex); 
     578        this.grid.fireEvent('columnmove', oldIndex, newIndex); 
    576579    }, 
    577580 
     
    866869    onBeforeLoad : function(store, options) 
    867870    { 
     871        var proxy = store.proxy; 
     872        if (proxy.activeRequest[Ext.data.Api.actions.read]) { 
     873            proxy.getConnection().abort(proxy.activeRequest[Ext.data.Api.actions.read]); 
     874        } 
     875 
     876        this.isBuffering    = false; 
     877        this.isPreBuffering = false; 
     878 
    868879        options.params = options.params || {}; 
    869880 
     
    10551066    processRows : function(startRow, skipStripe, paintSelections) 
    10561067    { 
    1057         skipStripe = skipStripe || !this.grid.stripeRows; 
    1058         // we will always process all rows in the view 
    1059         startRow = 0; 
    1060         var rows = this.getRows(); 
    1061         var cls = ' x-grid3-row-alt '; 
     1068        if(!this.ds || this.ds.getCount() < 1){ 
     1069            return; 
     1070        } 
     1071 
    10621072        var cursor = this.rowIndex; 
    1063  
    1064         var index      = 0; 
    1065         var selections = this.grid.selModel.selections; 
    1066         var ds         = this.ds; 
    1067         var row        = null; 
    1068         for(var i = startRow, len = rows.length; i < len; i++){ 
    1069             index = i+cursor; 
    1070             row   = rows[i]; 
    1071             // changed! 
    1072             row.rowIndex = index; 
     1073        skipStripe   = skipStripe || !this.grid.stripeRows; 
     1074        var rows     = this.getRows(); 
     1075        var index    = 0; 
     1076 
     1077        Ext.each(rows, function(row, idx) { 
     1078            row.rowIndex = index = cursor+idx; 
     1079            row.className = row.className.replace(this.rowClsRe, ' '); 
     1080            if (!skipStripe && (index + 1) % 2 === 0) { 
     1081                row.className += ' x-grid3-row-alt'; 
     1082            } 
    10731083 
    10741084            if (paintSelections !== false) { 
    10751085                if (this.grid.selModel.isSelected(this.ds.getAt(index)) === true) { 
    1076                     this.addRowClass(index, "x-grid3-row-selected"); 
     1086                    this.addRowClass(index, this.selectedRowClass); 
    10771087                } else { 
    1078                     this.removeRowClass(index, "x-grid3-row-selected"); 
     1088                    this.removeRowClass(index, this.selectedRowClass); 
    10791089                } 
    10801090                this.fly(row).removeClass("x-grid3-row-over"); 
    10811091            } 
    1082  
    1083             if(!skipStripe){ 
    1084                 var isAlt = ((index+1) % 2 == 0); 
    1085                 var hasAlt = (' '+row.className + ' ').indexOf(cls) != -1; 
    1086                 if(isAlt == hasAlt){ 
    1087                     continue; 
    1088                 } 
    1089                 if(isAlt){ 
    1090                     row.className += " x-grid3-row-alt"; 
    1091                 }else{ 
    1092                     row.className = row.className.replace("x-grid3-row-alt", ""); 
    1093                 } 
    1094             } 
     1092        }, this); 
     1093 
     1094        // add first/last-row classes 
     1095        if(cursor === 0){ 
     1096            Ext.fly(rows[0]).addClass(this.firstRowCls); 
     1097        } else if (cursor + rows.length == this.ds.totalLength) { 
     1098            Ext.fly(rows[rows.length - 1]).addClass(this.lastRowCls); 
    10951099        } 
    10961100    }, 
     
    14861490        } 
    14871491 
    1488         var mask    = this._loadMaskAnchor._mask; 
    1489         var maskMsg = this._loadMaskAnchor._maskMsg; 
     1492        var dom  = this._loadMaskAnchor.dom; 
     1493        var data = Ext.Element.data; 
     1494 
     1495        var mask    = data(dom, 'mask'); 
     1496        var maskMsg = data(dom, 'maskMsg'); 
    14901497 
    14911498        if (show) {