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