Opened 6 years ago

Closed 6 years ago

#17403 closed defect (invalid)

Different tree widgets interact unexpectedly with each other in DnD

Reported by: huangqiongfeng Owned by:
Priority: undecided Milestone: tbd
Component: DnD Version: 1.8.4
Keywords: Cc:
Blocked By: Blocking:

Description

We have two different tree widgets (MyTreeA and MyTreeB) that extend dijit.tree. We re-write checkAcceptance() method in both tree widgets to meeting our requirements. But the problem we are seeing is that checkAcceptance() in both tree widgets will be invoked if we try to dnd on any of the two tree widgets. For example, if we try to do dnd operation on MyTreeA, checkAcceptance() will be called on both MyTreeA and MyTreeB. Is this an expected behavior? To workaround this problem, we have to add some code in checkAcceptance() to make sure the tree in dnd source is the expected tree. Besides this problem, we are also seeing another similar problem. We declare a new dnd source that extends dijit.tree.dndSource. We re-write onDndDrop() method in our own dnd source. We only use this dnd source in MyTreeA. MyTreeB is using the default dnd source (dijit.tree.dndSource). But the problem is this customized onDndDrop() method will also be invoked while we try to dnd on MyTreeB. The workaround is to add some code in onDndDrop() method to make sure the tree in dndsource is the expected tree.

Change History (1)

comment:1 Changed 6 years ago by bill

Resolution: invalid
Status: newclosed

Yes, it's expected behavior that onDndStart (and thus checkAcceptance) and onDndEnd get called on all DnD targets regardless of where the DnD starts or ends.

Imagine that I start dragging an object A from a DnD source A_Container. It's useful that all DnD targets get notified (and checkAcceptance() gets called on all targets), so that the targets know that the object being dragged might be dropped on top of them. This lets the targets indicate visually that they will or will not accept the drop. For example, the Tree might turn gray to indicate that it can't accept the specified object being dragged.

Sounds like you are merely considering the case of dragging within a tree rather than dragging objects between two DnD containers (Trees or otherwise).

Note: See TracTickets for help on using tickets.