#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: |
Description
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 dojo.data.ItemFileWriteStore 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 dojo.data 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 13 years ago by
comment:2 Changed 13 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
(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.
(In [12309]) - Fix DnD for Tree, specifically when dragging elements within the Tree
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
!strict