Event fires when the node is dropped.
Parameters
Name | Type | Description |
---|---|---|
e | {object} | event data |
id | {string} | the id of the record |
parentId | {object} | the id of the new parend node |
orderNumber | {object} | the new order number |
Examples
Event Sample
<div id="tree" data-source="/Locations/Get" data-drag-and-drop="true"></div>
<script>
var tree = $('#tree').tree();
tree.on('nodeDrop', function (e, id, parentId, orderNumber) {
var node = tree.getDataById(id),
parent = parentId ? tree.getDataById(parentId) : {};
if (parent.text === 'North America') {
alert('Can\'t add children to North America.');
return false;
} else {
alert(node.text + ' is added to ' + parent.text + ' as ' + orderNumber);
return true;
}
});
</script>