1. #1
    Sencha User
    Join Date
    Apr 2012
    Posts
    16
    Vote Rating
    0
    Answers
    1
    csanchezr85 is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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
    Vote Rating
    0
    Answers
    1
    csanchezr85 is on a distinguished road

      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!

Thread Participants: 1

Tags for this Thread