Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5560 closed defect (fixed)

Tree: support drag and drop of nodes within tree

Reported by: bill Owned by: bill
Priority: high Milestone: 1.1
Component: Dijit Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Currently Tree (dijit._tree.dndSource::onDndDrop()) supports dragging of elements from a list into the tree, at which point it calls However, it doesn't support dragging nodes from within the tree (which would require modifying the children attribute on the old parent and the new parent):

  1. if node has an old parent, remove item from that parent's list of children items
  2. if node has a new parent, add item to that parent's list of children items

Change History (5)

comment:1 Changed 14 years ago by bill

(In [12020]) Get basic tree node --> tree node DnD working. Still some kinks to work out and possibly a refactoring to hide special treatment of top level data store items in a data store decorator (aka wrapper). Refs #5560.

comment:2 Changed 14 years ago by bill

Resolution: fixed
Status: newclosed

(In [12309]) - Fix DnD for Tree, specifically when dragging elements within the Tree

  • Refactor Tree to take a single item as the root node, rather than a set of items specified by a query. The root node of the tree can be hidden via the showRoot parameter. Query and label parameters deprecated; will be removed in v2.
  • implemented ForestStoreDecorator? which wraps a given store, mapping all items matching a given query as children of a synthesized root item. Use this to connect Tree to stores that don't have a single root item.

Reason for changes: The old tree design worked for simple cases but broke down for DnD. Refactoring let's users define handlers for when a node is added/removed from the top of the tree (ie, when it changes between a top level item and a child of another item, or vice-versa), and for efficiently detecting changes to the list/order of top level items (and then notifying Tree).

Note that Tree DnD won't work with ItemFileWriteStore? and nested data (rather than _reference). See #5786 about that.

Fixes #4544, #4977, #5560, refs #5536


comment:3 Changed 14 years ago by bill

(In [12417]) Update Tree tests to explicitly instantiate ForestStoreDecorator?. Refs #4544, #4977, #5560, #5536.

comment:4 Changed 14 years ago by bill

(In [13110]) Remove some unused code from test file, causing spurious errors on IE. Refs #5560

comment:5 Changed 14 years ago by bill

Description: modified (diff)
Note: See TracTickets for help on using tickets.