Results 1 to 2 of 2

Thread: Ext.dd.ScrollManager failing when trying to unregister an el that was not registered

  1. #1
    Sencha Premium User
    Join Date
    Apr 2011
    Posts
    126

    Default Ext.dd.ScrollManager failing when trying to unregister an el that was not registered

    ext-7.1.0.46

    I recently added an extended class of Ext.dd.DropZone. Since doing so when I destroy the app-panel of my main app to get back to login panel (on logout) I am throwing a null error on el. "TypeError: el is null". I have tracked this down to the unregister function of Ext.dd.ScrollManager. I can also reproduce it if I just destroy the panel that has the plugin defined.

    Code:
    Ext.define('Ext.ux.dd.CellFieldDropZone', {
         extend: 'Ext.dd.DropZone',
         alias: 'plugin.ux-cellfielddropzone',
    Code:
            
       plugins: [{
            ptype: 'cellediting',
            clicksToEdit: 1
        },{
            ptype: 'ux-cellfielddropzone',
            ddGroup: 'grid-to-mapping',
            onCellDrop: function(fieldName, value) {
                this.callParent(arguments);
                return true;
            },
            id: 'myplugin'
        }],
    I have put console.log calls in the register and unregister functions so I can see when they are called. The register function does not get called until the grid panel is shown. In my case this panel may not be shown. I put code in afterrender to call init() on the plugin but the plugin is null here.

    Code:
        listeners: {
            beforeedit: 'onBeforeEdit',
            beforedestroy: function(g) {
                var view = g.getView();
                var el = view.getEl();
                var foo = 'bar';
    //            if(el) {
    //                Ext.dd.ScrollManager.unregister(el);
    //            } else {
    //                Ext.dd.ScrollManager.unregister(view);
    //            }
                var p = g.getPlugin('myplugin');
                Ext.destroy(p);
                foo = 'bared';
            },
            afterrender: function(g, eOpts) {
    //            var p = g.getPlugin('myplugin');
    //            p.init();
            }
        }
    I can include all the code of my plugin if necessary. I used the example from KitchenSink 'Ext.ux.dd.CellFieldDropZone' and modified it for my needs which is to drag a column from one grid into a column of another grid.

    This issue is currently blocking our release so any help/confirmation would be greatly appreciated.

    Thank you
    Rudy

  2. #2
    Sencha Premium User
    Join Date
    Apr 2011
    Posts
    126

    Default

    I currently have this working. Since the plugin is very specific for what I am using it for I have moved it into the view folder with the grid and controller not this made a difference in the bug. What resolved it was to remove the plugin from the "normal" definition:
    Code:
        plugins: [{
            ptype: 'cellediting',
            clicksToEdit: 1
    //    },{
    //        ptype: 'mappingfielddropzone',
    //        ddGroup: 'grid-to-mapping'
        }],
    and I added it to the beforerender event:
    Code:
        listeners: {
            beforeedit: 'onBeforeEdit',
            beforerender: function(g, opt) {
                var p = new Designer.view.intmapping.MappingFieldDropZone({ddGroup: 'grid-to-mapping'});
                g.addPlugin(p);
            }
        }
    This is working for both a Development and Production build.

Posting Permissions

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