Browse Source

cloning old data before updating to fix #1378

fixDataView
Martin Fischer 9 years ago
parent
commit
1eccf093ac
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      lib/DataSet.js

+ 3
- 2
lib/DataSet.js View File

@ -243,10 +243,11 @@ DataSet.prototype.update = function (data, senderId) {
var addOrUpdate = function (item) { var addOrUpdate = function (item) {
var id = item[fieldId]; var id = item[fieldId];
if (me._data[id]) { if (me._data[id]) {
var oldData = util.extend({}, me._data[id]);
// update item // update item
id = me._updateItem(item); id = me._updateItem(item);
updatedIds.push(id); updatedIds.push(id);
updatedData.push(item);
updatedData.push(oldData);
} }
else { else {
// add new item // add new item
@ -513,7 +514,7 @@ DataSet.prototype.forEach = function (callback, options) {
var filter = options && options.filter, var filter = options && options.filter,
type = options && options.type || this._options.type, type = options && options.type || this._options.type,
data = this._data, data = this._data,
itemIds = Object.key(data),
itemIds = Object.keys(data),
i, i,
len, len,
item, item,

Loading…
Cancel
Save