From f84743053edd9fbd5b29d17453d4a95843785c76 Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Tue, 18 Oct 2016 10:56:40 -0400 Subject: [PATCH 1/2] Adds oldData to the update event payload in dataview to match dataset. --- lib/DataView.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/DataView.js b/lib/DataView.js index 32a7325a..fb779c7f 100644 --- a/lib/DataView.js +++ b/lib/DataView.js @@ -300,6 +300,7 @@ DataView.prototype._onEvent = function (event, params, senderId) { var ids = params && params.items; var data = this._data; var updatedData = []; + var oldData = []; var added = []; var updated = []; var removed = []; @@ -330,6 +331,7 @@ DataView.prototype._onEvent = function (event, params, senderId) { if (this._ids[id]) { updated.push(id); updatedData.push(params.data[i]); + oldData.push(params.oldData[i]); } else { this._ids[id] = true; @@ -368,7 +370,7 @@ DataView.prototype._onEvent = function (event, params, senderId) { this._trigger('add', {items: added}, senderId); } if (updated.length) { - this._trigger('update', {items: updated, data: updatedData}, senderId); + this._trigger('update', {items: updated, data: updatedData, oldData: oldData}, senderId); } if (removed.length) { this._trigger('remove', {items: removed}, senderId); From 7c6248626bafe871f21bd66a530ba3e774501a93 Mon Sep 17 00:00:00 2001 From: Zachariah Brown Date: Tue, 18 Oct 2016 14:25:28 -0400 Subject: [PATCH 2/2] Re-ordered keys to match other usage. --- lib/DataView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/DataView.js b/lib/DataView.js index fb779c7f..ba7a864e 100644 --- a/lib/DataView.js +++ b/lib/DataView.js @@ -370,7 +370,7 @@ DataView.prototype._onEvent = function (event, params, senderId) { this._trigger('add', {items: added}, senderId); } if (updated.length) { - this._trigger('update', {items: updated, data: updatedData, oldData: oldData}, senderId); + this._trigger('update', {items: updated, oldData: oldData, data: updatedData}, senderId); } if (removed.length) { this._trigger('remove', {items: removed}, senderId);