开发者

Dojo when drop[dnd drag drop] it creates a new div

开发者 https://www.devze.com 2023-02-24 12:23 出处:网络
As title, how to make this? I have already done drag and drop using dnd.Source and dnd.Target. Have no idea if it possible to make it when drop and it creates/generates a div whic开发者_开发技巧h it c

As title, how to make this? I have already done drag and drop using dnd.Source and dnd.Target. Have no idea if it possible to make it when drop and it creates/generates a div whic开发者_开发技巧h it can closable.


I think it would be possible to hook up to the onDndDrop event of your dnd.Target by doing some along these lines:

dojo.connect(yourtarget, "onDndDrop", _dndHandler);

Then in the _dndHandler function you could create a new div using the dojo.create and dojo.place:

var newdiv = dojo.create("div", { innerHTML: "This is my new div" });
dojo.place(newdiv, dojo.byId("your_target_id", "first"));

Hope it helps

/Daniel

0

精彩评论

暂无评论...
验证码 换一张
取 消