Changeset 13896

Show
Ignore:
Timestamp:
06/04/08 15:23:27 (7 months ago)
Author:
BryanForbes
Message:

fixes #6892 !strict

  • Fixed multiple queries going out for each render.
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojox/trunk/grid/DataGrid.js

    r13860 r13896  
    1515        _cache: null, 
    1616        _pages: null, 
     17        _pending_requests: null, 
    1718        _bop: -1, 
    1819        _eop: -1, 
     
    2627                this._rows = []; 
    2728                this._cache = []; 
     29                this._pending_requests = {}; 
    2830 
    2931                this._setStore(this.store); 
     
    116118 
    117119        _onFetchComplete: function(items, req){ 
    118                 if(!items || items.length == 0){ return; } 
    119                 //console.log(items); 
    120                 dojo.forEach(items, function(item, idx){ 
    121                         this._addItem(item, req.start+idx); 
    122                 }, this); 
    123                 if(req.isRender){ 
    124                         this.setScrollTop(0); 
    125                         this.postrender(); 
    126                 } 
     120                if(items && items.length > 0){ 
     121                        //console.log(items); 
     122                        dojo.forEach(items, function(item, idx){ 
     123                                this._addItem(item, req.start+idx); 
     124                        }, this); 
     125                        if(req.isRender){ 
     126                                this.setScrollTop(0); 
     127                                this.postrender(); 
     128                        } 
     129                } 
     130                this._pending_requests[req.start] = false; 
    127131        }, 
    128132 
     
    136140 
    137141        _fetch: function(start, isRender){ 
    138                 if(this.store){ 
    139                         var start = start || 0; 
     142                var start = start || 0; 
     143                if(this.store && !this._pending_requests[start]){ 
     144                        this._pending_requests[start] = true; 
    140145                        //console.log("fetch: ", start); 
    141146                        this.store.fetch({ 
     
    209214 
    210215        // paging 
    211         _requestsPending: function(inBoolean){ 
     216        _requestsPending: function(inRowIndex){ 
     217                return this._pending_requests[inRowIndex]; 
    212218        }, 
    213219 
     
    241247                if(count > 0){ 
    242248                        this._requests++; 
    243                         this._requestsPending(true); 
    244                         setTimeout(dojo.hitch(this, "_fetch", row, false), 1); 
    245                         //this.requestRows(row, count); 
     249                        if(!this._requestsPending(row)){ 
     250                                setTimeout(dojo.hitch(this, "_fetch", row, false), 1); 
     251                                //this.requestRows(row, count); 
     252                        } 
    246253                } 
    247254        },