Ticket #6491 (closed defect: fixed)
deleting an item at the end of a grid with fast scrolling enabled errors
| Reported by: | guest | Owned by: | BryanForbes |
|---|---|---|---|
| Priority: | normal | Milestone: | 1.2 |
| Component: | DojoX Grid | Version: | 1.1.0 |
| Severity: | major | Keywords: | grid item delete |
| Cc: |
Description
Fast scrolling allows the grid to fetch non incremental pages of data. If I have a datastore with enough data, I can move the scroll bar to the bottom and it will fetch the last page without fetching other pages above it. This means the model.data array will contain "undefined" entries above the last page that was fetched. When I then delete one of the rows, the model gets the "onDelete" event and calls _storeDatumDelete which in turn calls _removeItems. model._removeItems attempts to rebuild the _rowIdentities by iterating through the model.data array. It doesn't check if the model.data array entries are actual objects or undefined and when trying to get the dojo_data_item and consequently fails.
The model._removeItems method should be changed to look like this...
_removeItems: function(inRowIndexes){
dojox.grid.data.Dynamic.prototype.remove.apply(this, arguments); // Rebuild _rowIdentities this._rowIdentities = {}; for (var i = 0; i < this.data.length; i++){
var data = this.data[i]; if ( data ) this._setRowId(data.dojo_data_item, 0, i);
}
}