Browse Source

Fixed #670: bug when updating data in a DataSet, when Network is connected to the DataSet via a DataView

v3_develop
jos 9 years ago
parent
commit
edbb35a519
2 changed files with 6 additions and 3 deletions
  1. +1
    -0
      HISTORY.md
  2. +5
    -3
      lib/network/Network.js

+ 1
- 0
HISTORY.md View File

@ -14,6 +14,7 @@ http://visjs.org
- Added pull request for usage of Icons. Thanks @Dude9177! - Added pull request for usage of Icons. Thanks @Dude9177!
- Allow hierarchical view to be set in setOptions. - Allow hierarchical view to be set in setOptions.
- Fixed manipulation bar for mobile. - Fixed manipulation bar for mobile.
- Fixed #670: bug when updating data in a DataSet, when Network is connected to the DataSet via a DataView.
### Graph2d ### Graph2d

+ 5
- 3
lib/network/Network.js View File

@ -329,7 +329,7 @@ function Network (container, data, options) {
network.start(); network.start();
}, },
'update': function (event, params) { 'update': function (event, params) {
network._updateNodes(params.items, params.data);
network._updateNodes(params.items);
network.start(); network.start();
}, },
'remove': function (event, params) { 'remove': function (event, params) {
@ -1687,12 +1687,14 @@ Network.prototype._addNodes = function(ids) {
* @param {Number[] | String[]} ids * @param {Number[] | String[]} ids
* @private * @private
*/ */
Network.prototype._updateNodes = function(ids,changedData) {
Network.prototype._updateNodes = function(ids) {
var nodesData = this.nodesData.get(ids);
var nodes = this.nodes; var nodes = this.nodes;
for (var i = 0, len = ids.length; i < len; i++) { for (var i = 0, len = ids.length; i < len; i++) {
var id = ids[i]; var id = ids[i];
var node = nodes[id]; var node = nodes[id];
var data = changedData[i];
var data = nodesData[i];
if (node) { if (node) {
// update node // update node
node.setProperties(data, this.constants); node.setProperties(data, this.constants);

Loading…
Cancel
Save