Opened 9 years ago
Closed 8 years ago
#15661 closed feature (worksforme)
Tree: ObjectStoreModel support for drop between
Reported by: | bill | Owned by: | bill |
---|---|---|---|
Priority: | high | Milestone: | 2.0 |
Component: | Dijit | Version: | 1.7.3 |
Keywords: | Cc: | ||
Blocked By: | #15660 | Blocking: |
Description (last modified by )
See also #15660. ObjectStoreModel needs updates to support betweenThreshold.
Here's some workaround code from Anthony Erwin (IBM, CCLA) that can be used as a starting point:
/* * Subclassing ObjectStoreModel so we can support dnd and other desired operations (while maintaining order) in * the preview tree. */ var CustomObjectStoreModel = declare(ObjectStoreModel, { newItem: function ( /* dijit /tree/dndSource.__Item */ args, /*Item*/ parent, /* int ?*/ insertIndex, /*Item*/ before){ //Call superclass this .inherited(arguments); //Add hack to notify tree that parent's children have changed (so ordering can be maintained) this ._parentChildrenChanged(parent); }, pasteItem: function ( /*Item*/ childItem, /*Item*/ oldParentItem, /*Item*/ newParentItem, /*Boolean*/ bCopy, /* int ?*/ insertIndex, /*Item*/ before){ //Call superclass this .inherited(arguments); //Add hack to notify tree that new parent's children have changed (so ordering can be maintained) if (newParentItem && (oldParentItem != newParentItem)) { this ._parentChildrenChanged(newParentItem); } else { this ._parentChildrenChanged(oldParentItem); } }, _parentChildrenChanged: function (parent) { delete this .childrenCache[ this .getIdentity(parent)]; var onComplete = function (children) { this .onChildrenChange(parent, children); }.bind( this ); var onError = function () { console.error( "CustomObjectStoreModel._parentChildrenChanged: problem getting children for parent = " + this .getIdentity(parent)); }; this .getChildren(parent, onComplete, onError); }, // NOT needed for dnd mayHaveChildren: function (item) { return !item.leaf; } });
Change History (3)
comment:1 Changed 9 years ago by
Blocked By: | 15660 added |
---|---|
Description: | modified (diff) |
Milestone: | tbd → 2.0 |
Type: | enhancement → feature |
comment:2 Changed 8 years ago by
Priority: | undecided → high |
---|
comment:3 Changed 8 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Looking at the code now, it seems like ObjectStoreModel supports drop-between, although it's impossible to test since dojo/store/Memory doesn't support the before or parent parameters (#15660). But I'm going to close this ticket for now.