Issue 259: Folder node drags without mousedown and with dynatree exception: sourceNode is null.
Status:  WontFix
Owner: ----
Closed:  Oct 2013
Project Member Reported by wbgil...@gmail.com, Dec 27, 2011
What steps will reproduce the problem?
1. Configure tree with dnd options
2. Ensure onDragStart allows dragging folders
3. Expand a folder

- jquery.dynatree.js function _initDragAndDrop(tree) is called.
- helper function's sourceNode is always null
- browsers throws many exceptions thereafter:

sourceNode is null
return sourceNode.tree._onDragEven...sourceNode, null, event, null, null); 
jquery.dynatree.js, Line 3162

What is the expected output? What do you see instead?
For folder to *not* start dragging without mouse button being down (nor during lazy load).
AND
No dynatree exceptions.


What version of the product are you using?
$Revision: 528, 2011-09-17 18:58:59$


On what operating system and browser?
Windows 7 Pro, Firefox 8.0


Please provide any additional information below.
QUESTION: what is best way to disable dnd while lazy loading?  I can remove/readd dnd options while lazy loading, but that does not seem like a good idea (abstraction/encapsulation violation on dynatree).

If not reproducible or obvious question, I will see about jsfiddle reproducible example.  But, I have to setup mock-up data and such, so hoping the question/situation is solvable just asking.

Dec 28, 2011
Project Member #1 moo...@wwwendt.de
You could use `node.hasChildren() === undefined` to check for unloaded/loading lazy nodes.
Another way is to test for the 'dynatree-loading' class.
Then, return `false` in onDragStart.
I opened  issue 260  for a more elegant solution
 
Dec 28, 2011
Project Member #2 moo...@wwwendt.de
I couldn't reproduce the bug on Safari (trying FF later).
How do you expand the node? Using keys?

Status: Waiting
Labels: Milestone-Release1.2.1
Dec 28, 2011
Project Member #3 wbgil...@gmail.com
Expand the folder node by clicking on the dynatree-expander image.
Dec 28, 2011
Project Member #4 moo...@wwwendt.de
Tried with FF9 on Windows Vista here
    http://wwwendt.de/tech/dynatree/doc/sample-dnd.html#
Everything looks OK...
I can expand and then drag or even drag the expander icon without exceptions.

Can you reproduce it there?
Dec 28, 2011
Project Member #6 wbgil...@gmail.com
No, but I'm holding off on this one because it does not reproduce with a later version, r543 (the autoscroll fix).  (Debugging it, the mousedown to expand is somehow also seen as a dragstart after 'tolerance' mouse movement.  Again, not repro'ing in r543 so waiting on autoscroll issues). 

r543 has outstanding issues with autoscroll I reported.  If they're resolved and this doesn't repro, that'd be great.  :-))
Dec 29, 2011
Project Member #8 wbgil...@gmail.com
This can be reproduced with r570, but I have dynatree wired up to my server for lazy loading so I'm not sure how to make a repro for you.

The problem: a folder node starts dragging without the mouse down and during lazy loading.  See two attached screen shots where you can still see the loading icon while the node has been dragged.

In my dragStart I tried this:

                onDragStart: function (node) {
                    if (node.isLoading()) {
                        return (false);
                    }
                     ...

But, that did not work.

I'm looking for other/more things to check in DragStart to avoid this.  Ideas?

I think it's time-based.  Lazy loading taking a second or three is easier to reproduce.  Loading from data already on the client (e.g. the dynatree examples) never reproduced the problem.
dynatree - dragNdrop starts while loading.png
15.2 KB   View   Download
dynatree - dragNdrop starts while loading - 2.png
20.2 KB   View   Download
Dec 29, 2011
Project Member #9 moo...@wwwendt.de
I will try with the Python test server, but Probably Not before saturday
Dec 31, 2011
Project Member #10 moo...@wwwendt.de
I tried this with FF9 and 5 second delayed Ajax requests:
- click on th [*] to expand a lazy node
- while the node is loading (spinning wheel) move the mouse around without pressing a key

--> no problems here :-/

I also tried your 
    if(node.isLoading()) return false;
an that works as expected to prevent dragging while loading.

Dec 31, 2011
Project Member #11 wbgil...@gmail.com
Thanks for trying.
If I point you to my server would you take a look?  
Jan 1, 2012
Project Member #12 moo...@wwwendt.de
sure, 
happy new year by the way :)
Jan 3, 2012
Project Member #13 moo...@wwwendt.de
Ben,

I clicked on the "Business Units" tree expanders and moved the cursor shortly after that.
Looks ok to me, although the loading times are very fast, so maybe I am missing your described effects :-/ (using FF9.0.1 on Vista)

For testing you could comment out yout onClick-handler, maybe that interferes in some way...
And please try again, if node.isLoading() rellay returns false.

If all this doesn't work, I could modify the code to no start dragging, when the user tries to drag the expander icon - i think that wouldn't hurt.
Jan 3, 2012
Project Member #14 wbgil...@gmail.com
Martin,

try this, it reproduces the problem every time for me:

1. Go to that URL I emailed you.
2. Drag the Clinology node to the Unassigned Hosts list and drop it.
   - The nodes under Clinology will disappear from the dynatree and appear in the Unassigned Hosts.
3. Drag an Unassigned Host to the Clinology node and try to drop it on it.  The dynatree drop event will not occur without first clicking the dynatree.  

Jan 3, 2012
Project Member #15 wbgil...@gmail.com
> The dynatree drop event will not occur without first clicking the dynatree.  
Therefore, be sure *not* to click on anything but the above 1, 2, 3.  :-)
Jan 5, 2012
Project Member #16 wbgil...@gmail.com
Hi Martin, did you try again?  Haven't see a post/reply in 2 days. :-)
Jan 5, 2012
Project Member #17 moo...@wwwendt.de
not yet, sorry. hope i find some time on the weekend
Jan 7, 2012
Project Member #18 moo...@wwwendt.de
Hi Ben,

is this problem related to your comment #8 (how)?
It seems you are describing a different bug here?

Your site is pretty complex, and I can't add debug code there (even Dynatree's debugLevel is 0, cause you're using a release build, so I see no output).
So it's hard for me to debug. 

This sample - using a standard draggable - seems to work though:
  http://wwwendt.de/tech/dynatree/doc/sample-dnd3.html

1. open the page
2. drag 'Drag me around' and drop over the right tree.

If you can tweak this sample so that we can reproduce the problem, I could easier try help.

Jan 7, 2012
Project Member #19 moo...@wwwendt.de
ok, I think your comment #14 refers to  issue 264 
Jan 14, 2012
Project Member #20 moo...@wwwendt.de
can you still reproduce this issue (Folder node drags without mousedown and with dynatree exception: sourceNode is null)?
Jan 14, 2012
Project Member #21 wbgil...@gmail.com
Yes it still happens
But I cannot reproduce it at-will.
Jun 6, 2012
Project Member #22 moo...@wwwendt.de
Deferred, so v1.2.1 can be released shortly.
Labels: -Milestone-Release1.2.1 Milestone-Release1.2.2
Oct 6, 2012
Project Member #23 moo...@wwwendt.de
(No comment was entered for this change.)
Labels: -Milestone-Release1.2.2 Milestone-Release1.2.x
Oct 6, 2013
Project Member #24 moo...@wwwendt.de
Closing 'Waiting' issues without timely answer
Status: Done
May 3, 2014
Project Member #25 moo...@wwwendt.de
(No comment was entered for this change.)
Status: WontFix
Labels: -Milestone-Release1.2.x Milestone-Release1.2.5