Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#5786 closed defect (wontfix)

Tree DnD doesn't work with ItemFileWriteStore/nested items

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


This is either a bug or a limitation depending on your point of view. Not planning to fix but filing ticket for reference purposes.

Assume you have a that points to nested data like below, rather than using _reference:

	identifier: 'id',
	label: 'name',
	items: [
		{ id: '0', name:'Fruits', children:[
			{ id: '1',name:'Citrus'}
		{ id: '2', name:'Vegetables'}

Dragging a child element to the root (ie, moving Citrus to be a top level item) won't work. This is mainly because the API doesn't support an API to make an element "top level". All you can do is set Fruits.children to be an empty array, orphaning Citrus. However, even if orphaning Citrus caused it to become top level, Tree still wouldn't work because it would have no notification that the Citrus item had changed and thus (possibly) had become top level, so it won't even check.

Thus, for Tree/DML you need to use _reference.

Change History (3)

comment:1 Changed 14 years ago by bill

(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:2 Changed 14 years ago by bill

Resolution: wontfix
Status: newclosed

comment:3 Changed 14 years ago by bill

(In [13109]) Use references instead of nested items in ItemFileReadStore? test data, so that can properly move level 2 items to level 1, or vice-versa (where the root node is level 0). Refs #5786.

Note: See TracTickets for help on using tickets.