Opened 8 years ago

Closed 7 years ago

#12643 closed defect (fixed)

Tree: function pasteItem breaks if newParentItem is null

Reported by: WienerDog Owned by: bill
Priority: high Milestone: 1.8
Component: Dijit Version: 1.6.0
Keywords: dnd, dijit.tree, newParentItem, avatar.js Cc: WienerDog
Blocked By: Blocking:

Description (last modified by bill)

OK, this is a little hard to explain but I will try.

In /dojotoolkit/dijit/tests/tree/test_Tree_DnD.html try dragging around an element inside the tree from either tree from one the bottom two divs (ones with blue boxes by them) VERY slowly. Slowly drag until the avatar appears for the very first time (you have to move the mouse pixel by pixel). If you release the mouse the very first time the avatar appears, the element will disappear from the list and return an error in firebug.

The error I found occurs in dijit.tree.ForestStoreModel.js (and probably TreeStoreModel.js as well) in the function: pasteItem(item, oldParentItem, newParentItem, bCopy, insertIndex)

When the avatar appears for the very first time, and you release the mouse, pasteItem is passed a null value for newParentItem. The simple hack I used to solve it was simply checking if value newParentItem is null and then letting the function continue if it isn't. Also in dijit.tree.dndSource.js I simply check inside of onDndDrop if newParentItem is null. If it is null, I call onDndCancel.

A messy hack, but it works for me.

Attachments (2)

AfterDrop.png (76.4 KB) - added by WienerDog 8 years ago.
Screen capture of tree after drop
beforedrop.png (122.6 KB) - added by WienerDog 8 years ago.
before dropping element when avatar first appears

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by WienerDog

Attachment: AfterDrop.png added

Screen capture of tree after drop

Changed 8 years ago by WienerDog

Attachment: beforedrop.png added

before dropping element when avatar first appears

comment:1 Changed 8 years ago by bill

Description: modified (diff)
Priority: highnormal
severity: criticalnormal
Summary: dijit.Tree function pasteItem breaks if newParentItem is nullTree: function pasteItem breaks if newParentItem is null

Thanks for the description, I'll take a look when I have time.

There are a number of tickets open about drag corner cases like this.

comment:2 Changed 8 years ago by WienerDog

Your welcome. I found this bug particularly causes alot of breaks in dijit.tree; especially a really large, nested tree. Once I overwrote the pasteItem in my code, I haven't been able to break any of my trees since.

comment:3 Changed 8 years ago by bill

Component: DnDDijit
Owner: changed from Eugene Lazutkin to bill

comment:4 Changed 7 years ago by bill

Milestone: tbd1.8
Resolution: fixed
Status: newclosed

Fixed in [28025].

Note: See TracTickets for help on using tickets.