Yes, you’re right, we drag second node to the first.
Examples show only dragging nodes to primordial folders and don’t allow drag a node to another node.
We have the following code (properties of treeGrid):
autoFetchData: true,
canEdit: true,
canReorderRecords: true,
canReparentNodes:true,
canDrop:true,
canAcceptDroppedRecords: true,
canDragRecordsOut: true,
canDropOnLeaves:true,
dragDataAction: "move",
nodeIcon:"icons/company.gif",
folderIcon:"icons/groupcompany.gif",
showDropIcons:false,
showOpenIcon:true,
selectionType:"single",
closedIconSuffix:"",
editByCell: true,
editEvent: "click",
data: isc.Tree.create({
ID:"partsTree1",
modelType: "parent",
rootValue: 0,
nameProperty: "name",
idField: "id",
parentIdField: "parentId",
autoFetchData: true,
dataSource: "mappingSpringDMI"
}),
fields: [
{name: "name", title:"Name", canEdit:false, width:200}
/*List of other fields*/
],
folderDrop : function (dragRecords, dropFolder, index) {
var id = dragRecords[0].id;
/*alert("dragRecords[0].id" + dragRecords[0].id +" dropFolder.parentId" + this.data.getChildren(dropFolder)[index-1].parentId + " dropFolder.id" + dropFolder.id + " index:" + index);*/
var dropNode = "";
if (index > 0) {
dropNode = this.data.getChildren(dropFolder)[index - 1];
} else {
dropNode = dropFolder;
}
var isMapping = (headerLabel.getContents() == headerModeMap)
if (!isMapping && (dragRecords[0].parentId == dropNode.id)) {
isc.warn("Please, note! Your operation doesn't change company hierarchy.");
} else if (id == dropNode.id /*|| isSubsidaryItself(dropNode, id) == true*/) {
isc.warn("You can't make the company subsidiary of itself!");
} else {
var dropOnName = "subsidiary of " + dropNode.name;
var isStandalone = false;
if (dropNode.id == 0) {
dropOnName = "stand-alone company";
isStandalone = true;
}
if (isStandalone && isMapping) {
isc.warn("You can't make stand-alone company in a mapping mode!");
} else {
isc.confirm("Do you really want to make " + dragRecords[0].name + " " + dropOnName + "?", function(value) {
up(value)
});
function up(value) {
if (value) {
myTree2.updateData({dragRecord :dragRecords[0].id, dragOn : dropFolder, index: index, dropNode: dropNode.id}, "myTree2.fetchData(searchTreeTwoForm.getValuesAsCriteria());myTree1.fetchData(searchTreeOneForm.getValuesAsCriteria())");
}
}// end function
}
}//else
}