Browse Source

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
fix2580
Alexander Wunschik 7 years ago
parent
commit
ef5b2910af
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      examples/graph2d/08_performance.html
  2. +2
    -2
      lib/DataSet.js

+ 1
- 1
examples/graph2d/08_performance.html View File

@ -147,4 +147,4 @@
var graph2d = new vis.Graph2d(container, dataset, options); var graph2d = new vis.Graph2d(container, dataset, options);
</script> </script>
</body> </body>
</html>
</html>

+ 2
- 2
lib/DataSet.js View File

@ -730,7 +730,7 @@ DataSet.prototype.clear = function (senderId) {
var i, len; var i, len;
var ids = Object.keys(this._data); var ids = Object.keys(this._data);
var items = []; var items = [];
for (i = 0, len = ids.length; i < len; i++) { for (i = 0, len = ids.length; i < len; i++) {
items.push(this._data[ids[i]]); items.push(this._data[ids[i]]);
} }
@ -912,7 +912,7 @@ DataSet.prototype._getItem = function (id, types) {
} }
if (!converted[this._fieldId]) { if (!converted[this._fieldId]) {
converted[this._fieldId] = id;
converted[this._fieldId] = raw.id;
} }
return converted; return converted;

Loading…
Cancel
Save