Closed
Bug 299971
Opened 19 years ago
Closed 16 years ago
nsDragAndDrop.js doesn't allow dragging (drag and drop) within a tree widget
Categories
(Toolkit :: UI Widgets, defect)
Toolkit
UI Widgets
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: bugzilla, Unassigned)
References
Details
Attachments
(1 file)
|
2.29 KB,
patch
|
neil
:
first-review-
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.7.7) Gecko/20050414 Firefox/1.0.3 nsDragAndDrop.js prevents drag and drop within any one element. The function checkCanDrop() returns false if the source node is the same as the target node (the one being dragged over). This works fine for dragging and dropping in listboxes, for example, because the source node should be a listitem and the target node will be a different listitem or the listbox itself. We get problems for tree widgets because the entire tree is a single treechildren element, so it's impossible to drag a node on the tree to a different position using nsDragAndDrop. The workaround is for the extension author to write the drag and drop javascript code themself, but that pretty much defeats the purpose of nsDragAndDrop.js. It's also worth noting that there is no easy way for an extension writer to discover why their onDrop function isn't firing. Reproducible: Always Steps to Reproduce:
| Reporter | ||
Comment 1•19 years ago
|
||
The problem line is line 582 in /toolkit/content/nsDragAndDrop.js
Changing that from:
this.mDragSession.canDrop = this.mDragSession.sourceNode != aEvent.target;
to:
this.mDragSession.canDrop = this.mDragSession.sourceNode.tagName !=
"treechildren" && this.mDragSession.sourceNode != aEvent.target;
would be the simplest fix.
Comment 3•19 years ago
|
||
I can make a patch for this, but I don't see the usefulness of using nsDragAndDrop with trees. Is there a way to get a row of a tree the drop happened on? If not, why is nsDragAndDrop useful here?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Version: unspecified → Trunk
Comment 4•19 years ago
|
||
I'd like to be able to drag and drop items from one container (folder) in a tree into other containers in the same tree.
Can't one obtain the row on which the drop happened this way?
onDrop : function(evt, transferData, session) {
var row = {}, col = {}, o = {};
myTree.treeBoxObject.getCellAt(evt.clientX, evt.clientY, row, col, o);
}
Comment 5•19 years ago
|
||
as suggested. Didn't test the XPFE part.
Attachment #211443 -
Flags: first-review?(neil)
Comment 6•19 years ago
|
||
Comment on attachment 211443 [details] [diff] [review] patch I don't think this is the right approach.
Attachment #211443 -
Flags: first-review?(neil) → first-review-
Comment 9•16 years ago
|
||
The new drag and drop api added in bug 356295 makes nsDragAndDrop.js obsolete.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•