Success! Looks like we've fixed this one. According to our records the fix was applied for DSGNR-1377 in a recent build.
  1. #1
    Sencha Premium Member
    Join Date
    Feb 2009
    Posts
    316
    Vote Rating
    3
    azuroff will become famous soon enough

      0  

    Default TreeViewDragDrop plugin listeners configured incorrectly

    TreeViewDragDrop plugin listeners configured incorrectly


    I added the TreeViewDragDrop plugin to a tree view and created event listeners for the "drop" and "beforedrop" events.

    The code gets written out with the listeners: {} as part of the plugin config, like this:

    Code:
    Ext.applyIf(me, {
        viewConfig: {
            plugins: [
                Ext.create('Ext.tree.plugin.TreeViewDragDrop', {
                    dropGroup: 'treeDDGroup',
                    enableDrag: false,
                    listeners: {
                        beforedrop: {
                            fn: me.onTreedragdroppluginBeforeDrop,
                            scope: me
                        },
                        drop: {
                            fn: me.onTreedragdroppluginDrop,
                            scope: me
                        }
                    }
                })
            ]
        }
    })
    However, the listeners: {} should be part of the viewConfig object instead -

    Code:
    Ext.applyIf(me, {
        viewConfig: {
            plugins: [
                Ext.create('Ext.tree.plugin.TreeViewDragDrop', {
                    dropGroup: 'treeDDGroup',
                    enableDrag: false,
                })
            ],
            listeners: {
                beforedrop: {
                    fn: me.onTreedragdroppluginBeforeDrop,
                    scope: me
                },
                drop: {
                    fn: me.onTreedragdroppluginDrop,
                    scope: me
                }
            }
        }
    });
    As deployed by Designer, the event handlers never fire. If I manually move the listeners: {} config to the correct place, they do fire.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,198
    Vote Rating
    120
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Thanks for the bug report.

    You are correct, as documented in the Ext 4.x docs, the event is added/fired on the view itself instead of the plugin.
    http://docs.sencha.com/ext-js/4-0/#!...ent-beforedrop

    The question will be whether or not we continue to leave the events defined on the tree plugin and then hoist them up to the view on code generation OR if we dynamically add a drop/beforedrop event to the treeview when the plugin is added/removed and then let code generation work as usual.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha Premium Member
    Join Date
    Feb 2009
    Posts
    316
    Vote Rating
    3
    azuroff will become famous soon enough

      0  

    Default


    Since the docs list those events as part of the plugin itself, it would be more intuitive to leave them defined on the plugin itself and hoist them up to the view at code generation time. I don't think people would necessarily expect to find the drop and beforedrop events in the list of view events.

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,198
    Vote Rating
    120
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    This will be fixed in the next build (> 298).
    Aaron Conran
    @aconran
    Sencha Architect Development Team

Thread Participants: 1