Opened 5 years ago

Closed 5 years ago

#18142 closed task (fixed)

DnD item disappears when drop in Tree with betweenthreshold...

Reported by: overtune Owned by: bill
Priority: undecided Milestone: 1.11
Component: Dijit Version: 1.10.0
Keywords: Cc:
Blocked By: Blocking:

Description

Hi!

I'm having some problem with getting DnD to work correctly with a Tree component. The problem occurs when dropping an item between two other (with betweenthreshold). The problem seems to exist in the demo-application of the Tree component to: http://dojotoolkit.org/reference-guide/1.10/dijit/Tree.html#betweenthreshold

Start the demo and drag and drop "Africa" between "Oceania" and "Europe". This causes "Africa" to disappear...

Change History (4)

comment:1 Changed 5 years ago by overtune

Anyone else having this problem? It can be recreated in the latest releases of Firefox/Chrome/Safari? on the Mac. In IE I can't seem to get any demos on dojotoolkit to work right now (it only opens up a white popup). But when I test the Drag n drop locally I get the same "disappearing bug" on IE as well.

comment:2 Changed 5 years ago by bill

Probably it's just a "bug" in the example code. As https://github.com/dojo/dijit/blob/master/tree/ObjectStoreModel.js says:

To support drag and drop, besides implementing getChildren() and dojo/store/Observable, the store must support the parent option to put(). And in order to have child elements ordered according to how the user dropped them, put() must support the before option.

I don't see the example code doing the support for "before" and IIRC the Memory store doesn't support it natively.

Version 1, edited 5 years ago by bill (previous) (next) (diff)

comment:3 Changed 5 years ago by bill

Milestone: tbd1.11
Owner: set to bill
Status: newassigned
Type: defecttask

OK, for I'll revert the example in the doc to when it was working, against dojo/data.

If you want to support betweenThreshold against a dojo/store (rather than against a dojo/data), you'll need to make the store's put() method handle the before option. Therefore, I think you'll need for each parent to keep a list of its children rather than each child having a reference to its parent.

comment:4 Changed 5 years ago by bill

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.