I have 2 trees and need to drag node to node from one tree to another?
But I can't do this.But when I drag node to folder it's ok.
But I can't do this.But when I drag node to folder it's ok.
This item already contains a child item with that name
isc.PartsTreeGrid.create({ ID:"myTree1", autoFetchData: true, canEdit: true, canReorderRecords: true, canAcceptDroppedRecords: true, canDragRecordsOut: true, canDropOnLeaves:true, dragDataAction: "move", nodeIcon:"icons/16/person.png", showDropIcons:false, showFilterEditor: true, closedIconSuffix:"", editByCell: true, editEvent: "click", canFilter:true, folderDrop : function (dragRecords, dropFolder) { var id = dropFolder.id; var node = myTree1.getSelectedRecord(); myTree1.fetchData({dragRecord : dragRecords, dragOn:id}); }, data: isc.Tree.create({ ID:"partsTree1", modelType: "parent", rootValue: 0, nameProperty: "name", idField: "id", parentIdField: "parentId", autoFetchData: true, dataSource: "mappingSpringDMI" }), fields: [ {name: "name", title:"Legal Name", canEdit:false, canFilter:true, width:200}, {name: "id", title:"Address", canEdit:false, canFilter:false} ] }), isc.VStack.create({width:32, height:74, layoutAlign:"center", membersMargin:10, members:[ isc.Img.create({src:"icons/32/arrow_right.png", width:32, height:32, click:"myTree2.transferSelectedData(myTree1)" }), isc.Img.create({src:"icons/32/arrow_left.png", width:32, height:32, click:"myTree1.transferSelectedData(myTree2)" }) ]}), isc.PartsTreeGrid.create({ ID:"myTree2", left:250, autoFetchData: true, canEdit: true, canReorderRecords: true, canAcceptDroppedRecords: true, canDragRecordsOut: true, canDropOnLeaves:true, dragDataAction: "move", nodeIcon:"icons/16/person.png", showDropIcons:false, showFilterEditor: true, closedIconSuffix:"", editByCell: true, editEvent: "click", canFilter:true, folderDrop : function (dragRecords, dropFolder) { var id = dropFolder.id; myTree2.fetchData({dragRecord : dragRecords, dragOn : id}); }, data: isc.Tree.create({ ID:"partsTree2", modelType: "parent", rootValue: 0, nameProperty: "name", idField: "id", parentIdField: "parentId", autoFetchData: true, dataSource: "mappingSpringDMI" }), fields: [ {name: "name", title:"Name", canEdit:false, canFilter:true, width:200}, {name: "id", title:"Address", canEdit:false, canFilter:false} ] }) ]})
canDropOnLeaves:true
myTree1 myTree2 ----------------- ----------------- NODE1 NODE1 NODE2 NODE2 NODE3 NODE3 FOLDER4 FOLDER4 NODE5 NODE5 NODE6 NODE6 FOLDER7 FOLDER7 NODE8 NODE8 NODE9 NODE9
myTree1 myTree2 ----------------- ----------------- FOLDER2 FOLDER2 NODE1 NODE1 NODE3 NODE3 FOLDER4 FOLDER4 NODE5 NODE5 NODE6 NODE6 FOLDER7 FOLDER7 NODE8 NODE8 NODE9 NODE9
autoFetchData: true, canEdit: true, canReorderRecords: true, canReparentNodes:true, canDrop:true, canAcceptDroppedRecords: true, canDragRecordsOut: true, canDropOnLeaves:true, dragDataAction: "move", nodeIcon:"icons/16/person.png", showDropIcons:false, showFilterEditor: true, closedIconSuffix:"", editByCell: true, editEvent: "click", canFilter:true,
isc.VLayout.create({ members: [ isc.TreeGrid.create({ height: 200, width: 600, nodeIcon: "icons/16/folder_document.png", folderIcon: "icons/16/folder_document.png", showOpenIcons: false, showDropIcons: false, closedIconSuffix:"", canDragRecordsOut: true, canAcceptDroppedRecords: true, canDropOnLeaves: true, data: isc.Tree.create({ modelType: "parent", nameProperty: "Name", idField: "EmployeeId", parentIdField: "ReportsTo", data: [ {EmployeeId:"4", ReportsTo:"1", Name:"Charles Madigen"}, {EmployeeId:"188", ReportsTo:"4", Name:"Rogine Leger"}, {EmployeeId:"189", ReportsTo:"4", Name:"Gene Porter"}, {EmployeeId:"265", ReportsTo:"189", Name:"Olivier Doucet"}, {EmployeeId:"264", ReportsTo:"189", Name:"Cheryl Pearson"} ] }), fields: [ {name: "Name", treeField:true} ], folderDrop : function(nodes, folder, index, sourceWidget) { isc.Log.logInfo("Dropped on:" + folder.Name + ", index: " + index); } }), isc.TreeGrid.create({ height: 200, width: 600, nodeIcon: "icons/16/folder_document.png", folderIcon: "icons/16/folder_document.png", showOpenIcons: false, showDropIcons: false, closedIconSuffix:"", canDragRecordsOut: true, canAcceptDroppedRecords: true, canDropOnLeaves: true, data: isc.Tree.create({ modelType: "parent", nameProperty: "Name", idField: "EmployeeId", parentIdField: "ReportsTo", data: [ {EmployeeId:"3", ReportsTo:"1", Name:"A"}, {EmployeeId:"1848", ReportsTo:"3", Name:"B"}, {EmployeeId:"1829", ReportsTo:"3", Name:"C"}, {EmployeeId:"2625", ReportsTo:"1829", Name:"D"}, {EmployeeId:"2624", ReportsTo:"1829", Name:"E"} ] }), fields: [ {name: "Name", treeField:true} ], folderDrop : function(nodes, folder, index, sourceWidget) { isc.Log.logInfo("Dropped on:" + folder.Name + ", index: " + index); } }) ] });
17:43:54.586:MUP0:INFO:Log:Dropped on:C, index: null ... 17:45:11.794:MUP0:INFO:Log:Dropped on:Gene Porter, index: null
drop : function() { var dropRow = this.getEventRow(); var dropFolder = this.getDropFolder(); var dropRecord = null; if(dropRow >= 0) dropRecord = this.getRecord(dropRow); var draggedRecords = isc.Event.getDragTarget().getDragData(); // handle drop event }
Comment