Browse Source

Fixed #1033: Moved item data not updated in DataSet when using an asynchronous `onMove` handler

flowchartTest
jos 8 years ago
parent
commit
4fd843edd0
2 changed files with 5 additions and 10 deletions
  1. +2
    -0
      HISTORY.md
  2. +3
    -10
      lib/timeline/component/ItemSet.js

+ 2
- 0
HISTORY.md View File

@ -16,6 +16,8 @@ http://visjs.org
- Fixed #1001: First element of group style being cut.
- Fixed #1071: HTML contents of a group not cleared when the contents is updated.
- Fixed #1033: Moved item data not updated in DataSet when using an asynchronous
`onMove` handler.
## 2015-07-03, version 4.4.0

+ 3
- 10
lib/timeline/component/ItemSet.js View File

@ -46,7 +46,7 @@ function ItemSet(body, options) {
remove: false
},
snap: TimeStep.snap,
snap: TimeStep.snap,
onAdd: function (item, callback) {
callback(item);
@ -1345,13 +1345,11 @@ ItemSet.prototype._onDragEnd = function (event) {
if (this.touchParams.itemProps) {
event.stopPropagation();
// prepare a change set for the changed items
var changes = [];
var me = this;
var dataset = this.itemsData.getDataSet();
var itemProps = this.touchParams.itemProps ;
this.touchParams.itemProps = null;
itemProps.forEach(function (props) {
var id = props.item.id;
var exists = me.itemsData.get(id, me.itemOptions) != null;
@ -1376,7 +1374,7 @@ ItemSet.prototype._onDragEnd = function (event) {
if (itemData) {
// apply changes
itemData[dataset._fieldId] = id; // ensure the item contains its id (can be undefined)
changes.push(itemData);
dataset.update(itemData);
}
else {
// restore original values
@ -1388,11 +1386,6 @@ ItemSet.prototype._onDragEnd = function (event) {
});
}
});
// apply the changes to the data (if there are changes)
if (changes.length) {
dataset.update(changes);
}
}
};

Loading…
Cancel
Save