Opened 13 years ago
Closed 13 years ago
#7278 closed defect (invalid)
move impossible with user-provided creator function
Reported by: | chucky | Owned by: | Eugene Lazutkin |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | DnD | Version: | 1.1.1 |
Keywords: | Cc: | [email protected]… | |
Blocked By: | Blocking: |
Description
When user provides their own creator(item, hint)
function to the constructor of dojo.dnd.Source
, it is impossible to implement the move between distinct Source
s.
The default creator
accomplishes the move operation by deleting the nodes from the original Source
. However, user creator
function does not have the necessary information (the original Source
and whether the operation is copy or move) to do so. Anyway, deleting items is not what one would expect to be done by the creator function.
To fix this, when move is required, I would suggest to either delete the items from somewhere else than in the default creator
or wrap the user provided creator
by one that also deletes the items from the original Source
.
Change History (4)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Sorry, my mistake. I didn't actually try it, I only looked at the source, what would happen. I thought that items were only deleted by source.delItem(node.id);
in the default creator. But, when the creator is provided,
if(!copy && this.creator){ source.deleteSelectedNodes(); }
does the job.
comment:3 Changed 13 years ago by
Just a final note: I experienced a problem when I wanted to implement a "trash" -- items dropped on trash would just disappear. I used the default creator for it and overrode insertNodes()
to do nothing. This didn't work, because the items didn't get deleted from the original source (which was supposed to be done in the default creator, but in the overriden insertNodes()
it never got called).
I assumed that this won't work even when I provide my own (dummy) creator, but it works because of that
if(!copy && this.creator){ source.deleteSelectedNodes(); }
comment:4 Changed 13 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
I don't understand what the problem is. Does dojo/tests/dnd/flickr_viewer.html work for you? It uses creator functions. If you mean something different please attach a test case which shows the problem.