Dojo DnD: how to access newly copied node on onDndDrop event?
- by toshinao
Hi.
I am working on code like the following.
01: var c1 = new dojo.dnd.Source('container1', {copyOnly:true}); // container1 is a div
02: var c2 = new dojo.dnd.Source('container2'); // container2 is a div
03: var list = [];
04: for (var i = 0; i < 3; i++) { list.push( dojo.create('div') ); }
05: c1.insertNodes(false, list);
06:
07: function checkDndCopy(nodes, target){
08: dojo.forEach(nodes, function(node){ alert(node.id); } );
09: }
10: dojo.subscribe("/dnd/drop", function(){
11: var mgr = dojo.dnd.manager();
12: checkDndCopy(mgr.nodes, mgr.target);
13: });
The nodes inserted to the c1 at line 05 have id of "dojoUnique1, donoUnique2, dojoUnique3".
On a event of drag and drop a node from c1 to c2, a onDndDrop event is fired and the subscribe method
defined in line10-13 is invoked.
I expected that newly copied node appears in the nodes (for example) at line 08. But this is not true.
When dojoUnique1 is target of drag and drop, nodes at line 08 contains only dojoUnique1.
I want to modify some attributes of newly copied nodes on the event of onDndDrop. Please let me
know how such a thing is realized.