Browse Source

cloning old data before updating to fix #1378

fixDataView
Martin Fischer 8 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 id = item[fieldId];
if (me._data[id]) {
var oldData = util.extend({}, me._data[id]);
// update item
id = me._updateItem(item);
updatedIds.push(id);
updatedData.push(item);
updatedData.push(oldData);
}
else {
// add new item
@ -513,7 +514,7 @@ DataSet.prototype.forEach = function (callback, options) {
var filter = options && options.filter,
type = options && options.type || this._options.type,
data = this._data,
itemIds = Object.key(data),
itemIds = Object.keys(data),
i,
len,
item,

Loading…
Cancel
Save