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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,422
    Answers
    3901
    Vote Rating
    1271
      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
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  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
  •