Opened 12 years ago

Closed 12 years ago

#9336 closed defect (invalid)

Tree: problem on drag start when more than one tree is on a page

Reported by: Will Bunker Owned by:
Priority: high Milestone: tbd
Component: Dijit Version: 1.3.0
Keywords: Cc:
Blocked By: Blocking:


If multiple trees are on a page that are used independently. There is an issue where dragging a node on one tree incorrectly will mark both tree with this.isDragging = true in dndSource.js file.

There needs to be a conditional:

if (this !=source) {



at the top of onDndStart: function(source, nodes, copy) function, which clears up the issue, and I can't find any side effects but this probably needs to be run through unit tests, which I have tackled how to run yet.

You can see the issue with 2 independent trees on a page. If you successfully drag and drop one tree the other will generate errors when you attempt to drag one of it's branches. If you start dragging the original tree and abort, it will correctly set both to isDragging false and you can then drag and drop in second.

Change History (3)

comment:1 Changed 12 years ago by bill

Component: GeneralDijit
Owner: anonymous deleted
Summary: dijit.Tree has a problem when more than one tree is on a pageTree: problem on drag start when more than one tree is on a page

Well, onDndStart is also used to prepare a tree for receiving a drop, when you are dragging from one tree and dropping on another, or perhaps dragging from a grid and dropping on a tree. So, I don't want to just return...

What is the actual error you are seeing? Does it reproduce with tree/test_Tree_Dnd.html? (If not please attach a testcase.) AFAICT by looking at the code, isDragging just is understood to mean that a drag is in progress and thus the tree might receive a drop, not that the drag source is the given tree.

BTW, please mark dijit bugs as the "Dijit" component.

comment:2 Changed 12 years ago by Will Bunker

Went to build a test case to show you and realized my error. I had overridden onDndDrop in my usage. I was not calling this.onDndCancel() for the second tree when it was not being dropped on as you are in the dndSource.js version. Sorry for wasting your time but going through the exercise of setting up the example gives me a good idea of how to submit any future problems without submitting false alarms. Still trying to figure out how to rig up unit tests, I am used to doing them in Rails and love them, but haven't gotten the hang of it in Dojo. Do you know of any good tutorials and the tests. Looked at the tree test but couldn't figure out where the tests are coded and run. Thanks for you time.

comment:3 Changed 12 years ago by bill

Resolution: invalid
Status: newclosed

Ah OK good, glad you got it working.

I don't know of any tutorials for the tests except for and

Those two tutorials above are for the robot testing which is what we usually do for dijit automated tests, although for just making a test case to attach to a ticket you don't need to make it automated. (You can just give instructions on how to reproduce the problem.) Of course, test contributions are always appreciated.

Note: See TracTickets for help on using tickets.