Results 1 to 2 of 2

Thread: [4.2.1 GA] GridFilters activate and deactivate events issue

    Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User Daniil's Avatar
    Join Date
    Jun 2010
    Location
    Saint-Petersburg, Russia
    Posts
    1,018

    Default [4.2.1 GA] GridFilters activate and deactivate events issue

    REQUIRED INFORMATION

    Ext version tested:
    • Ext 4.2.1 GA

    Browser versions tested against:
    • IE9
    • Chrome

    DOCTYPE tested against:
    • <!DOCTYPE html>

    Description:
    • Grid filters fire activate and deactivate events without a need. The Filter class uses its config to create its menu including activate/deactivate listeners. But a Menu as a floating component uses the activate and deactivate events in its floating logic - i.e. it fires those events on show/hide.

    Steps to reproduce the problem:
    • Move the mouse over the DateFilter menu items

    The result that was expected:
    • The activate/deactivate listeners are not triggered

    The result that occurs instead:
    • The activate/deactivate listeners are triggered

    Test Case:

    Code:
    <!DOCTYPE html>
    <html>
    <head>
        <title>GridFilters activate and deactivate events issue</title>
    
        <link type="text/css" rel="stylesheet" href="../resources/css/ext-all.css" />
    
        <script type="text/javascript" src="../ext-all-dev.js"></script>
    
        <script type="text/javascript">
            Ext.Loader.setPath('Ext.ux', '../examples/ux');
            Ext.require([
                'Ext.ux.grid.FiltersFeature'
            ]);        
    
            Ext.onReady(function () {
                Ext.create("Ext.grid.Panel", {
                    renderTo: Ext.getBody(),
                    store: {
                        fields: [{
                            name: "test"
                        }],
                        data: [
                            { test: new Date() },
                            { test: new Date() },
                            { test: new Date() }
                        ]
                    },
                    columns: {
                        items: [{
                            text: "Test",
                            dataIndex: "test",
                            type: "date"
                        }]
                    },
                    features: [
                        Ext.create("Ext.ux.grid.FiltersFeature", {
                            local: true,
                            filters: [{
                                dataIndex: "test",
                                type: "date",
                                listeners: {
                                    deactivate: function () {
                                        console.log("deactivate");
                                    },
                                    activate: function () {
                                        console.log("activate");
                                    }
                                }
                            }]
                    })]                
                });
            });
        </script>
    </head>
    <body>
    
    </body>
    </html>


    HELPFUL INFORMATION


    Debugging already done:

    • The issue is here:

    Ext.ux.grid.filter.Filter's createMenu
    Code:
    createMenu: function(config) {
        config.plain = true;
        return Ext.create('Ext.menu.Menu', config);
    }

    • It creates a menu using a Filter's listeners including activate/deactivate ones, which a menu - a floating component - uses itself.

    Possible fix:
    • I would clone a config and prune activate/deactivate listeners.

    Code:
    Ext.ux.grid.filter.Filter.override({
        createMenu: function(config) {
            cfg = Ext.clone(config);
            cfg.plain = true;
                        
            if (cfg.listeners) {
                delete cfg.listeners.activate;
                delete cfg.listeners.deactivate;
            }
                    
            return Ext.create('Ext.menu.Menu', cfg);
        }
    });
    Object.NET
    Frameworks and Tools for .NET Developers
    --------------------------------------------------
    Ext.NET - Ext JS for ASP.NET - Examples | Twitter
    Bridge.NET - Write C#. Run JavaScript! - Live | Twitter
    --------------------------------------------------

  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

Posting Permissions

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