Results 1 to 3 of 3

Thread: Spreadsheet model crashes after row removed

    You found a bug! We've classified it as EXTJS-24343 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha Premium User
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default Spreadsheet model crashes after row removed

    1. Open http://examples.sencha.com/extjs/6.2...k/#spreadsheet

    2. Console: Ext.first('gridpanel').store.removeAll()

    3. Console: Ext.first('gridpanel').store.add({})

    4. Select some cell in the one grid row

    5. Ext.first('gridpanel').store.removeAt(0)

    Code:
    app.js?_dc=1490016128528:1 Uncaught TypeError: Cannot read property 'isModel' of null
        at w.setRow (app.js?_dc=1490016128528:1)
        at w.setPosition (app.js?_dc=1490016128528:1)
        at w.getCellByPosition (app.js?_dc=1490016128528:1)
        at w.getCell (app.js?_dc=1490016128528:1)
        at w.setHandle (app.js?_dc=1490016128528:1)
        at w.onSelectionFinish (app.js?_dc=1490016128528:1)
        at w.onSelectionFinish (app.js?_dc=1490016128528:1)
        at w.updateSelectionExtender (app.js?_dc=1490016128528:1)
        at w.onViewRefresh (app.js?_dc=1490016128528:1)
        at w.fire (app.js?_dc=1490016128528:1)
    
    
    ​

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    4,108

    Default

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

  3. #3
    Sencha Premium User
    Join Date
    Nov 2007
    Location
    Stockholm, Sweden
    Posts
    3,153

    Default

    The deselect method looks wrong:

    Code:
    deselect: function(records, suppressEvent) {
            // API docs are inherited
            var me = this,
                sel = me.selected,
                store = me.view.dataSource,
                len, i, record,
                changed = false;
            if (sel && sel.isRows) {
                if (!Ext.isArray(records)) {
                    records = [
                        records
                    ];
                }
                len = records.length;
                for (i = 0; i < len; i++) {
                    record = records[i];
                    if (typeof record === 'number') {
                        record = store.getAt(record);
                    }
                    changed = changed || sel.remove(record); // WRONG will only remove first record
                }
            }
            if (changed) {
                me.updateHeaderState();
                if (!suppressEvent) {
                    me.fireSelectionChange();
                }
            }
        },
    Should probably be:

    Code:
    deselect: function(records, suppressEvent) {
                // API docs are inherited
                var me = this,
                    sel = me.selected,
                    store = me.view.dataSource,
                    len, i, record,
                    changed = false;
                if (sel && sel.isRows) {
                    if (!Ext.isArray(records)) {
                        records = [
                            records
                        ];
                    }
                    len = records.length;
                    for (i = 0; i < len; i++) {
                        record = records[i];
                        if (typeof record === 'number') {
                            record = store.getAt(record);
                        }
    
                        if (sel.remove(record)) {
                            changed = true;
                        }
                    }
                }
                if (changed) {
                    me.updateHeaderState();
                    if (!suppressEvent) {
                        me.fireSelectionChange();
                    }
                }
            }

Similar Threads

  1. Spreadsheet model selection bug
    By mankz in forum Ext JS 6.x Bugs
    Replies: 3
    Last Post: 8 Apr 2017, 5:37 AM
  2. How to Drag from grid with spreadsheet model?
    By t.nissen in forum Sencha Ext JS Q&A
    Replies: 1
    Last Post: 20 Apr 2016, 8:09 AM
  3. Spreadsheet Model Confusion
    By gsoc2014 in forum Ext JS 6.x Q&A
    Replies: 1
    Last Post: 15 Mar 2016, 12:16 PM
  4. Replies: 1
    Last Post: 14 Mar 2016, 11:48 PM
  5. [FIXED] Spreadsheet selection model
    By Zdeno in forum Ext 5: Bugs
    Replies: 2
    Last Post: 9 Dec 2014, 9:48 PM

Posting Permissions

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