Results 1 to 2 of 2

Thread: argument of onSelectionStoreClear is wrong in Ext.mixin.Selectable

    You found a bug! We've classified it as EXTJS-23680 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1

    Default argument of onSelectionStoreClear is wrong in Ext.mixin.Selectable

    ExtJs Version:
    ExtJs 6.0.2.437

    Test case:
    https://fiddle.sencha.com/#fiddle/1eka

    Bug Description:
    A multiple-selection list(mode: 'MULTI'),
    1. select several records, for example, I select 3 records
    2. call list.getSelectionCount(), it returns 3
    3. call store.removeAll()
    4. call list.getSelectionCount() again, it not 0 but still 3

    Reason:
    Code:
    onSelectionStoreRemove: function(store, records) {    
        var me = this,
            selected = me.selected,
            ln = records.length,
            removed, record, i;
        if (me.getDisableSelection()) {
            return;
        }
        for (i = 0; i < ln; i++) {
            record = records[i];
            if (selected.remove(record)) {
                if (me.getLastSelected() == record) {
                    me.setLastSelected(null);
                }
                if (me.getLastFocused() == record) {
                    me.setLastFocused(null);
                }
                removed = removed || [];
                removed.push(record);
            }
        }
        if (removed) {
            me.fireSelectionChange([
                removed
            ]);
        }
    },
    onSelectionStoreClear: function(store) {
        var records = store.getData().items;
        this.onSelectionStoreRemove(store, records); //arguments 'records' should be the removed records, not the records left in the store
    }
    The code above is a piece of class 'Ext.mixin.Selectable'.

    The arguments 'records' of 'onSelectionStoreClear' should be the removed records, not the records left in the store, or it will not trigger the 'fireSelectionChange' inside 'onSelectionStoreRemove'


    Workaround:
    Override the 'onSelectionStoreClear' function of dataview.
    Code:
    Ext.define('Ext.overrides.dataview.DataView', {    
        override: 'Ext.dataview.DataView',
    
        onSelectionStoreClear: function(store, records) {
            this.onSelectionStoreRemove(store, records); //arguments 'records' should be the removed records, not the records left in the store
        }
    });

  2. #2

    Default

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

Similar Threads

  1. Fashion - Background mixin won't take another mixin as argument.
    By GSandoval-Greentree in forum Sencha Cmd
    Replies: 3
    Last Post: 16 Sep 2015, 1:06 PM
  2. [FIXED] [BETA1] Ext.mixin.Selectable refreshSelection
    By jensen83 in forum Sencha Touch 2.x: Bugs
    Replies: 3
    Last Post: 12 Feb 2012, 10:02 AM
  3. [CLOSED] Ext.mixin.Selectable cannot deselect by passing in an index
    By yoh.suzuki in forum Sencha Touch 2.x: Bugs
    Replies: 2
    Last Post: 16 Jan 2012, 2:40 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
  •