1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
<script type="text/javascript">
dojo.require("dojo.dnd.Container");
dojo.require("dojo.dnd.Manager");
dojo.require("dojo.dnd.Source");
function initDND(){
var c1;
c1 = new dojo.dnd.Source("container1");
c1.insertNodes(false, [1, "A", [1, 2, 3],
function(x){ return x + x; },
{toString: function(){ return "CUSTOM!"; }},
null]);
// example subscribe to events
dojo.subscribe("/dnd/start", function(source){
console.debug("Starting the drop", source);
});
dojo.subscribe("/dnd/drop/before", function(source, nodes, copy, target){
if(target == c1){
console.debug(copy ? "Copying from" : "Moving from", source, "to", target, "before", target.before);
}
});
dojo.subscribe("/dnd/drop", function(source, nodes, copy, target){
if(target == c1){
console.debug(copy ? "Copying from" : "Moving from", source, "to", target, "before", target.before);
}
});
dojo.connect(c4, "onDndDrop", function(source, nodes, copy, target){
if(target == c4){
console.debug(copy ? "Copying from" : "Moving from", source);
}
});
};
dojo.addOnLoad(initDND);
</script>
<div id="dragLists">
<div style="margin: 5px; float: left;">
<h3>rub1</h3>
<div class="dndContainer dojoDndContainer dojoDndSource dojoDndTarget" jsid="rub_1" id="rub_1" dojotype="dojo.dnd.Source">
<div class="dojoDndItem" id="srub_1" jsid="srub_1">rub1_1</div>
<div class="dojoDndItem" id="srub_2" jsid="srub_2">rub1_2</div>
</div>
</div>
<div style="margin: 5px; float: left;">
<h3>rub1</h3>
<div class="dndContainer dojoDndContainer dojoDndSource dojoDndTarget" jsid="rub_3" id="rub_1" dojotype="dojo.dnd.Source">
<div class="dojoDndItem" id="srub_1" jsid="srub_1">rub2_1</div>
<div class="dojoDndItem" id="srub_2" jsid="srub_2">rub2_2</div>
</div>
</div>
<div style="margin: 5px; float: left;">
<h3>rub1</h3>
<div class="dndContainer dojoDndContainer dojoDndSource dojoDndTarget" jsid="rub_3" id="rub_1" dojotype="dojo.dnd.Source">
<div class="dojoDndItem" id="srub_1" jsid="srub_1">rub3_1</div>
<div class="dojoDndItem" id="srub_2" jsid="srub_2">rub3_2</div>
</div>
</div>
</div>
<a href="#" onClick="alert(dojo.dnd.rub_1.getItem(srub_1))">test</a> |
Partager