2012-10-22 63 views
0

我已經設置了一個左面板(源代碼)和右面板(源代碼爲& target)的小界面。Make dojo.dnd.Source out of dragulated/copied item

從左側面板拖動/複製到右側面板,並在刪除時創建新的div。

我現在希望能夠將項目放入新的div,即新的div也應該是源。

但是我不知道如何做到這一點,你能幫忙嗎?

HTML

<div id="left-panel"> 
    <div class="dojoDndItem">Div</div> 
</div> 

<div id="right-panel"> 
</div> 

JS

//This is a creator to be run when an item is dropped onto the right panel 

function myCreator(item, hint) { 
if (item == 'Div') { 
var myNode = dojo.create('div'); 
} 

//This is how I create the sources 

var leftPanel = new Source("left-panel", { copyOnly:true }); 

var rightPanel = new Source("right-panel", { accept:[ "div", "button", "image" ], creator:myCreator }); 

} 

回答

0

看到http://jsfiddle.net/n8UxB/

<div id="left-panel" class="container"> 
    <div class="dojoDndItem" dndType="foo">Div</div> 
    <div class="dojoDndItem" dndType="foo">Div2</div> 
</div> 

你不需要創造者的功能。並接受是爲dndType DOM屬性。