Results 1 to 3 of 3

Thread: How to manage drag event in 'treeviewdragdrop' plugin

  1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    16
    Answers
    1
    Vote Rating
    0
      0  

    Default Answered: How to manage drag event in 'treeviewdragdrop' plugin

    Hello,

    I would like to manage the drag event (before or on) when I drag an item from a tree. This tree has configured a viewConfig as this:
    Code:
    viewConfig = {
                                plugins: {
                                    ptype: 'treeviewdragdrop',
                                    pluginId: this.dndPluginId,
                                    appendOnly: this.appendOnly,
                                    enableDrag: true,
                                    enableDrop: true,
                                    nodeHighlightOnDrop: true,
                                    nodeHighlightOnRepair: true,
                                    nodeHighlightColor: _self.nodeHighlightColor
                                },
                                listeners: {
                                    beforedrop: {
                                        fn: function (node, data, overModel, dropPosition, dropHandler, eOpts) {
                                            if (_self.beforedrop) {
                                                _self.beforedrop(_self, node, data, overModel, dropPosition, dropHandler, eOpts);
                                            }
                                        }
                                    },
                                    drop: {
                                        fn: function (node, data, overModel, dropPosition, eOpts) {
                                            if (_self.drop) {
                                                _self.drop(_self, node, data, overModel, dropPosition, eOpts);
                                            }
                                        }
                                    }
                                }
                            };
    But the 'beforedrop' and 'drop' events don't are useful for me: what I want is exactly manage the drag of the item! I have been searching a solution in the forum and in other sources, but it seems that is impossible to manage the dragging of the tree item.

    Really, there is no way to manage any drag event for the 'treeviewdragdrop' plugin?

    Thanks in advance.

  2. You can add it via:

    Code:
    Ext.define('Override.tree.ViewDragZone', {
        override : 'Ext.tree.ViewDragZone',
    
        onDrag : function(e) {
            this.view.fireEvent('drag', this.view, this, e);
    
            this.callParent([e]);
        }
    });
    Now you have a drag event on the tree view (not the plugin). You can modify the arguments but right now it is the view, the Ext.tree.ViewDragZone, and the event passed to onDrag.

  3. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,070
    Answers
    3976
    Vote Rating
    1394
      0  

    Default

    You can add it via:

    Code:
    Ext.define('Override.tree.ViewDragZone', {
        override : 'Ext.tree.ViewDragZone',
    
        onDrag : function(e) {
            this.view.fireEvent('drag', this.view, this, e);
    
            this.callParent([e]);
        }
    });
    Now you have a drag event on the tree view (not the plugin). You can modify the arguments but right now it is the view, the Ext.tree.ViewDragZone, and the event passed to onDrag.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Apr 2012
    Posts
    16
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Hello, thanks for your answer! It's just what I was looking for. It seems to be an easy solution, but I was really very frustrated of proving other code...Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •