From ef5b2910afab6ed2c7d9bd68bc942659ea351770 Mon Sep 17 00:00:00 2001 From: Alexander Wunschik Date: Sat, 14 Jan 2017 20:38:36 +0100 Subject: [PATCH] fix(DataSet): make sure the right id-type is used internaly This fixes a fixed strange string-number conversion issue. It can happen that id "0" !== 0 what causes #2580. fixes #2580 --- examples/graph2d/08_performance.html | 2 +- lib/DataSet.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/graph2d/08_performance.html b/examples/graph2d/08_performance.html index 9a2ad2e1..75701fa5 100644 --- a/examples/graph2d/08_performance.html +++ b/examples/graph2d/08_performance.html @@ -147,4 +147,4 @@ var graph2d = new vis.Graph2d(container, dataset, options); - \ No newline at end of file + diff --git a/lib/DataSet.js b/lib/DataSet.js index 790a39e9..8ebee256 100644 --- a/lib/DataSet.js +++ b/lib/DataSet.js @@ -730,7 +730,7 @@ DataSet.prototype.clear = function (senderId) { var i, len; var ids = Object.keys(this._data); var items = []; - + for (i = 0, len = ids.length; i < len; i++) { items.push(this._data[ids[i]]); } @@ -912,7 +912,7 @@ DataSet.prototype._getItem = function (id, types) { } if (!converted[this._fieldId]) { - converted[this._fieldId] = id; + converted[this._fieldId] = raw.id; } return converted;