diff --git a/docs/data/dataset.html b/docs/data/dataset.html
index fd1cdd3d..39af677a 100644
--- a/docs/data/dataset.html
+++ b/docs/data/dataset.html
@@ -599,9 +599,8 @@ function (event, properties, senderId) {
properties is always an object containing a property
items, which contains an array with the ids of the affected
items. The update event has an extra field oldData
- containing the original data of the updated items, which allows to
- determine the changed fields of the changed items when comparing to
- the new item properties.
+ containing the original data of the updated items, and a field data
+ containing the changes: the properties of the items that are being updated.
diff --git a/lib/DataSet.js b/lib/DataSet.js
index 25ede879..f4ca42ec 100644
--- a/lib/DataSet.js
+++ b/lib/DataSet.js
@@ -236,6 +236,7 @@ DataSet.prototype.add = function (data, senderId) {
DataSet.prototype.update = function (data, senderId) {
var addedIds = [];
var updatedIds = [];
+ var oldData = [];
var updatedData = [];
var me = this;
var fieldId = me._fieldId;
@@ -243,11 +244,12 @@ 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]);
+ var oldItem = util.extend({}, me._data[id]);
// update item
id = me._updateItem(item);
updatedIds.push(id);
- updatedData.push(oldData);
+ updatedData.push(item);
+ oldData.push(oldItem);
}
else {
// add new item
@@ -274,14 +276,14 @@ DataSet.prototype.update = function (data, senderId) {
this._trigger('add', {items: addedIds}, senderId);
}
if (updatedIds.length) {
- var props = { items: updatedIds, oldData: updatedData };
- // TODO: remove deprecated property 'data' some day
- Object.defineProperty(props, 'data', {
- 'get': (function() {
- console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
- return this.get(updatedIds);
- }).bind(this)
- });
+ var props = { items: updatedIds, oldData: oldData, data: updatedData };
+ // TODO: remove deprecated property 'data' some day
+ //Object.defineProperty(props, 'data', {
+ // 'get': (function() {
+ // console.warn('Property data is deprecated. Use DataSet.get(ids) to retrieve the new data, use the oldData property on this object to get the old data');
+ // return updatedData;
+ // }).bind(this)
+ //});
this._trigger('update', props, senderId);
}
diff --git a/test/networkTest.html b/test/networkTest.html
index a35753df..b21fb4c8 100644
--- a/test/networkTest.html
+++ b/test/networkTest.html
@@ -1,62 +1,279 @@
-
+
+
+
-
-
+ .graph {
+ width: 100%;
+ height: 500px;
+ }
-
-
-
-
-