Changes between Version 3 and Version 4 of Ticket #15858, comment 9


Ignore:
Timestamp:
Aug 25, 2012, 10:57:53 AM (7 years ago)
Author:
Peter Jekel
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15858, comment 9

    v3 v4  
    9999For  dijit 2.0 however, I would suggest to remove onChildrenChange() event from the store models and instead have the model only pass the onNew() and onDelete() events from the store as there is no added benefit to the onChildrenChange() event. It only complicates things by handling events out of order.
    100100
     101To properly handle DnD introduce a new event "onRemove" in the model and tree with the tree implementation as follows:
     102
     103{{{
     104  onItemRemove: function( item, parentItem ) {
     105    // summary:
     106    //    Remove item as the result of a DnD operation
     107    // tag:
     108    //    Private
     109    var  parentId = this.model.getIdentity(parentItem),
     110        childId  = this.model.getIdentity(item),
     111        nodes    = this._itemNodesMap[childId],
     112        self     = this;
     113       
     114    array.forEach(nodes, function(node) {
     115        var parent = node.getParent();
     116        if (parent.item == parentItem) {
     117          self._removeNode(node);
     118        }
     119      });
     120  },
     121
     122}}}
     123
    101124Hope this helps a little.