Changeset 13591

Show
Ignore:
Timestamp:
05/06/08 13:48:53 (7 months ago)
Author:
peller
Message:

keep row ids consistent with dojo.data. Fixes #6670 !strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojox/trunk/grid/_data/model.js

    r13518 r13591  
    586586                // FIXME: where else do we need to keep this in sync? 
    587587                //Handle stores that implement identity and try to handle those that do not. 
    588                 if (this._canIdentify) { 
     588                if(this._canIdentify){ 
    589589                        this._rowIdentities[this.store.getIdentity(item)] = {rowId: offset+idx, item: item}; 
    590590                }else{ 
     
    629629        }, 
    630630        _storeDatumDelete: function(item){ 
    631                 if(dojo.indexOf(this._currentlyProcessing, item) != -1) 
     631                if(dojo.indexOf(this._currentlyProcessing, item) != -1){ 
    632632                        return; 
     633                } 
    633634                // the store has deleted some item under us, need to remove that item from 
    634635                // the view if possible.  It may be the deleted item isn't even in the grid. 
     
    639640        }, 
    640641        _storeDatumNew: function(item){ 
    641                 if(this._disableNew) 
     642                if(this._disableNew){ 
    642643                        return; 
     644                } 
    643645                // the store has added some item under us, need to add it to the view. 
    644646                this._insertItem(item, this.data.length); 
     
    657659                } 
    658660                var row = this._createRow(storeItem); 
     661                for(var i in this._rowIdentities){ //increment all the remaining row ids up one 
     662                        var rowIdentity = this._rowIdentities[i]; 
     663                        if(rowIdentity.rowId >= index){ 
     664                                rowIdentity.rowId++; 
     665                        } 
     666                } 
    659667                this._setRowId(storeItem, 0, index); 
    660668                dojox.grid._data.Dynamic.prototype.insert.apply(this, [row, index]); 
     
    738746                this.pages = []; 
    739747                this.bop = this.eop = -1; 
    740                 this.setData((keepStore?this.store:[])); 
     748                this.setData(keepStore ? this.store : []); 
    741749        }, 
    742750        processError: function(error, request){