I have a user interface where some properties are represented as draggable items, and they can be dragged off a toolbar and dropped on some receiving item which is then updated. For this I'm using the Dojo Drag and Drop. I have some Dojo Dnd Sources, Targets, several accept types, everything is working great.
Except that I don't want to actually move or copy the nodes of the sources to the targets. When the drop occurs I simply want to fire an event handler so I can modify the target in question, or make other updates in the UI as appropriate.
What is the best way to do this?
I've tried variations on a null creator fu开发者_运维技巧nction, calling cancel in an onDrop handler, removing the nodes that are passed to the onDrop handler from their parent, but none of these avenues seemed to work or be workable.
Thanks for any assistance.
I just wrote this code which does what you want. (Though it seems you've tried something similar that didn't work?)
// Gobble up dropped nodes
target.on(
"Drop",
lang.hitch(
target,
function( source, nodes, copy )
{
this.selectAll().deleteSelectedNodes();
}
)
);
精彩评论