Results 1 to 4 of 4

Thread: Extjs 6.0.1 Deselecting is realy slow

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Oct 2015
    Posts
    2

    Default Extjs 6.0.1 Deselecting is realy slow

    Deselecting is realy slow on buffered grid when i select lots of records and then try to select just one of them.

    Tested on ExtJS 4 and 6.

    Here is a fiddle where you can reproduce a bug.
    https://fiddle.sencha.com/#fiddle/1e50

    Steps for reproduction:
    - Select one record
    - Ctrl+A to select all of them
    - Select just one record now

    Actual result:
    It takes about 10 seconds to deselect them all, while selecting all of them is done in a second.

    Is there any workaround for this problem?
    If you need more information just say.

    I found a temporary solution. I overrided 2 methods in Ext.selection.Model.

    Code:
    doDeselect: function (records, suppressEvent) {
            var me = this,
                selected = me.selected,
                i = 0,
                len, record,
                attempted = 0,
                accepted = 0,
                commit;
    
            if (me.locked || !me.store) {
                return false;
            }
    
            if (typeof records === "number") {
                // No matching record, jump out
    record = me.store.getAt(records);
                if (!record) {
                    return false;
                }
                records = [record];
            }
            else
                if (!Ext.isArray(records)) {
                    records = [records];
                }
    
            commit = function () {
                ++accepted;
                selected.remove(record);
                if (record === me.selectionStart) {
                    me.selectionStart = null;
                }
            };
    
            len = records.length;
    
            me.suspendChanges();
            //OVERRIDE
            while (len) {
                len--;
                record = records[len];
                if (me.isSelected(record)) {
                    if (me.lastSelected === record) {
                        me.lastSelected = selected.last();
                    }
                    ++attempted;
                    me.onSelectChange(record, false, suppressEvent, commit);
                    if (me.destroyed) {
                        return false;
                    }
                }
            }
            me.resumeChanges();
    
            // fire selchange if there was a change and there is no suppressEvent flag
    me.maybeFireSelectionChange(accepted > 0 && !suppressEvent);
            return accepted === attempted;
    }
    Code:
    selectWithEventMulti: function (record, e, isSelected) {
        if (this.p_fastDeselect) {
            var me = this,
                shift = e.shiftKey,
                ctrl = e.ctrlKey,
                start = shift ? (me.getSelectionStart()) : null,
                selected = me.getSelection(),
                len = selected.length,
                toDeselect, i, item;
    
            if (shift && start) {
                me.selectRange(start, record, ctrl);
            }
            else
                if (ctrl && isSelected) {
                    if (me.allowDeselect) {
                        me.doDeselect(record, false);
                    }
                }
                else
                    if (ctrl) {
                        me.doSelect(record, true, false);
                    }
                    else
                        if (isSelected && !shift && !ctrl && len > 1) {
                            if (me.allowDeselect) {
                                //OVERRIDE
                                me.deselectAll();
                                me.select(record);
                            }
                        }
                        else
                            if (!isSelected) {
                                me.doSelect(record, false);
                            }
        }
        else {
            this.callParent(arguments);
        }
    }

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

    Default

    You can speed things up by giving the records an ID:
    https://fiddle.sencha.com/#fiddle/1e6h

  3. #3
    Sencha User
    Join Date
    Oct 2015
    Posts
    2

    Default

    Still way slower than selecting. My solution is much faster for me.

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

    Default

    Good to know. Thanks for sharing your findings with the community.

Similar Threads

  1. How to create realy Blank Project - minimal project without unnecessary files
    By Ilian.Mihov in forum Sencha Architect 3.x: Bugs
    Replies: 1
    Last Post: 5 Dec 2013, 11:33 AM
  2. How to create realy Blank Project - minimal project without unnecessary files
    By Ilian.Mihov in forum Sencha Architect 3.x: Q&A
    Replies: 1
    Last Post: 5 Dec 2013, 11:33 AM
  3. EXTJs calendar , Deselecting the selected date
    By Soumyajm in forum Ext: Q&A
    Replies: 1
    Last Post: 8 Aug 2012, 9:53 AM
  4. To slow extjs
    By northwest in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 3 May 2009, 8:38 AM
  5. How to know the Form.submit() method is realy completed?
    By vjanev in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 8 Sep 2007, 4:16 PM

Tags for this Thread

Posting Permissions

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