Results 1 to 9 of 9

Thread: [4.1.0-rc2] Chrome 18 + disappearing grid Editor

    Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-5864 in a recent build.
  1. #1
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default [4.1.0-rc2] Chrome 18 + disappearing grid Editor

    In Chrome 18.0.1025.151 beta, repeatedly commencing an edit then sorting a grid configured with the cellediting plugin causes the Editor to permanently disappear.

    Drop the following HTML + accompanying JSON into the
    /path/to/ext-4.1.0-rc2/examples/grid
    directory


    HTML file (wonky.html):
    Code:
    <html>
    <head>
        <link rel="stylesheet" href="../../resources/css/ext-all.css" />
    
        <script src="../../ext-all-debug.js"></script>
    
        <script>
            Ext.Loader.setConfig({
                enabled: true
            });
    
    
            Ext.define('GenericModel', {
                extend: 'Ext.data.Model',
                proxy: {
                    type: 'ajax',
                    url: 'records.js',
                    reader: {
                        root: 'records',
                        type: 'json'
                    }
                }
            });
    
    
            Ext.onReady(function(){
                var grid = Ext.create('Ext.grid.Panel', {
                    title: 'test',
                    store: {
                        model: 'GenericModel',
                        remoteSort: true,
                        autoLoad: true,
                        listeners: {
                            metachange: function(store, meta) {
                                grid.reconfigure(null, meta.columns);
                            }
                        }
                    },
                    columns: [], // required -- grid will throw an error otherwise
                    selType: 'cellmodel',
                    plugins: [{
                        ptype: 'cellediting',
                        clicksToEdit: 1
                    }]
                });
    
                Ext.create('Ext.container.Viewport', {
                    layout: 'fit',
                    items: grid
                });
            });
        </script>
    </head>
    <body>
    </body>
    </html>
    accompanying JSON file (records.js):
    Code:
    {
        "metaData": {
            "idProperty": "id",
    
            "fields": [
                {
                    "name": "common",
                    "type": "string"
                }
            ],
    
            "columns": [
                {
                    "text": "#",
                    "xtype": "rownumberer"
                },
                {
                    "dataIndex": "common",
                    "editor": {
                        "allowBlank": false
                    },
                    "flex": 1,
                    "text": "Common Name"
                }
            ]
        },
    
        "records": [
            {
                "id": 1,
                "common": "Bloodroot"
            },
            {
                "id": 2,
                "common": "Cowslip"
            },
            {
                "id": 3,
                "common": "Columbine"
            },
            {
                "id": 4,
                "common": "Marsh Marigold"
            },
            {
                "id": 5,
                "common": "Dutchman's-Breeches"
            }
        ],
    
        "total": 5
    }
    To reproduce the wonkiness:
    1) Load the html page in Chrome
    2) Click any cell to commence editing
    3) Click the grid header to sort the column
    4) Repeat steps (2) and (3) until the cell editor fails to appear when clicking a cell to commence an edit

    Sometimes, it takes as little as 1 attempt to reproduce the problem.
    Your mileage may vary however -- I've recorded as many as 6-7 attempts before the problem surfaced.

    I tested this in Safari and it worked no matter how many times i repeated step (4), so it doesn't seem (imho) like a webkit problem.


    [edit]
    I'm running OSX 10.7.3
    Last edited by mystix; 6 Apr 2012 at 5:31 AM. Reason: added platform info

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,449

    Default

    Hard to reproduce it sometimes. It took me upwards of 15 tries to get it on average.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Fullstack Engineer
    ________________
    Modus Create is based on the model of an open source team. We’re a remote, global team of experts in our field. To find out more about the work we do, head over to our website.

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Vancouver, Canada
    Posts
    157

    Default

    my entire site stopped working in Chrome 18. works fine everywhere else, even IE6.

  4. #4
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Chrome 18 has a bug. This must be a manifestation of that.

  5. #5
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    If you type

    Code:
    Ext.Number.constrain
    into the console command line, what does the source look like?

  6. #6
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    Quote Originally Posted by Animal View Post
    If you type

    Code:
    Ext.Number.constrain
    into the console command line, what does the source look like?
    Mine says:
    Code:
    function (number, min, max) {
                number = parseFloat(number);
    
                if (!isNaN(min)) {
                    number = math.max(number, min);
                }
                if (!isNaN(max)) {
                    number = math.min(number, max);
                }
                return number;
            }

  7. #7
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    That's the pre-workaround code.

    It should be this:

    Code:
            constrain: function(number, min, max) {
                number = parseFloat(number);
    
                // Do not attempt to process NaN. V8bug: http://code.google.com/p/v8/issues/detail?id=2056
                // Possible return of min or max value when NaN passed.
                if (!isNaN(number)) {
                    if (!isNaN(min)) {
                        number = math.max(number, min);
                    }
                    if (!isNaN(max)) {
                        number = math.min(number, max);
                    }
                }
                return number;
            },

  8. #8
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236

    Default

    Woot. Confirmed.

    @animal's Ext.Number.constrain override resolves the problem nicely
    (cellediting still works fine in Chrome 18+ after repeating my test case from post #2 > 30 times).


    Here's the drop-in override for those who are interested:
    Code:
    Ext.Number.constrain = function(number, min, max) {
        var math = Math;
    
        number = parseFloat(number);
    
        // Do not attempt to process NaN. V8bug: http://code.google.com/p/v8/issues/detail?id=2056
        // Possible return of min or max value when NaN passed.
        if (!isNaN(number)) {
            if (!isNaN(min)) {
                number = math.max(number, min);
            }
            if (!isNaN(max)) {
                number = math.min(number, max);
            }
        }
        return number;
    };

  9. #9
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,409

    Default

    Nice the know. Chrome 18 has been the cause of a lot of reports lately.

    Scott.

Posting Permissions

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