Results 1 to 8 of 8

Thread: remoteSort trigger an autoLoad ? (ExtJS 6.0.1)

    This duplicates another bug already reported in our system: EXTJS-19781
  1. #1
    Sencha Premium User
    Join Date
    Jun 2008
    Posts
    132

    Default remoteSort trigger an autoLoad ? (ExtJS 6.0.1)

    Hi - in Ext 4.0.0 there was a bug where setting remoteSort on a store would trigger an autoLoad. This was fixed in 4.0.1 AFAICT but a version of it is happening for me in 6.0.1. Specifically if I have groupField set on a store then if I also set remoteSort = true the store always autoloads.

    Code:
    Ext.define('Test.model.Model', {
        extend: 'Ext.data.Model',
    
    
        fields: [
            {name: 'Name', type: 'string'}
        ]
    });
    
    
    
    
    Ext.define('Test.view.List', {
        extend: 'Ext.grid.Panel',
        title: 'Test',
    
    
        store: {
            autoLoad: false,
            model: 'Test.model.Model',
            proxy: {
                type: 'ajax',
                url: '/backend'
            },
    
    
            // BUG: If groupField is set then remoteSort = true will trigger an autoLoad
            groupField: 'Name',
            remoteSort: true
        },
    
    
        columns: [
            {text: 'Name', dataIndex: 'name'}
        ]
    });
    
    
    
    
    Ext.define('Test.Application', {
        extend: 'Ext.app.Application',
        name: 'Test',
        launch: function () {
            var list = Ext.create('Test.view.List', {
                renderTo: Ext.getBody()
            });
        }
    });
    Is anyone else seeing this? Is this an ExtJS bug or am I missing something?


    Thanks

    - bill

  2. #2
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120

    Default

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

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

    Default

    Possible workaround/fix. Needs to be tested.
    Hope it helps.

    Code:
    Ext.define('MyApp.data.AbstractStore', {
        override: 'Ext.data.AbstractStore',
        /**
         * Groups data inside the store.
         * @param {String/Object} grouper Either a string name of one of the fields in this Store's
         * configured {@link Ext.data.Model Model}, or an object, or a {@link Ext.util.Grouper grouper} configuration object.
         * @param {String} [direction] The overall direction to group the data by. Defaults to the value of {@link #groupDir}.
         */
        group: function (grouper, direction) {
            var me = this,
                sorters = me.getSorters(false),
                change = grouper || (sorters && sorters.length);
            if (grouper && typeof grouper === 'string') {
                grouper = {
                    property: grouper,
                    direction: direction || me.getGroupDir()
                };
            }
            me.settingGroups = true;
            me.getData().setGrouper(grouper);
            delete me.settingGroups;
    
    
            if (change) {
                //Override - check autoLoad is enabled or store is loading/loaded
                var load = me.autoLoad || me.loading || me.isLoaded();
                if (me.getRemoteSort() && load) {
                    me.load({
                        scope: me,
                        callback: me.fireGroupChange
                    });
                } else {
                    me.fireEvent('datachanged', me);
                    me.fireEvent('refresh', me);
                    me.fireGroupChange();
                }
            } else // groupchange event must fire when group is cleared.
            // The Grouping feature forces a view refresh when changed to a null grouper
            {
                me.fireGroupChange();
            }
        }
    });

  4. #4
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    219

    Default

    It is very similar to this other bug:
    EXTJS-15348
    Store autoLoad=false is ignored if remoteFilter is true and there are filters in Grid
    https://www.sencha.com/forum/showthr...ilters-in-Grid

    I've created a Fiddle with this bug:

  5. #5
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    219

    Default

    It seems the same bug reported for Ext JS 4.2 here:
    EXTJS-8093
    [4.2 b] Store autoLoad false is ignored if groupField is set and remoteSort is true

    https://www.sencha.com/forum/showthr...teSort-is-true

  6. #6
    Ext JS Premium Member
    Join Date
    Mar 2008
    Location
    Phoenix, AZ
    Posts
    651

    Default

    @bhutten

    I am also seeing this bug with ExtJS 6.0.2, and would like to see it fixed - again.

  7. #7
    Sencha User
    Join Date
    Apr 2013
    Posts
    137

    Default

    Same problem in 6.2.1!

  8. #8
    Sencha Premium User
    Join Date
    Nov 2013
    Location
    Piacenza, Italy
    Posts
    219

    Default

    Support reports it is fixed in versions 6.2.2 and 6.5.1.345.

    Note: it seems to be fixed also in 6.5.0 (at least my Fiddle now works correctly), but may be it is a partial fix.

Similar Threads

  1. Replies: 3
    Last Post: 18 Dec 2015, 4:09 PM
  2. Replies: 2
    Last Post: 9 Jan 2014, 5:20 AM
  3. Replies: 2
    Last Post: 19 Aug 2013, 9:40 AM
  4. [INFOREQ] [4.2] Store config autoLoad ignore when remoteSort = true
    By nukboon in forum Ext:Bugs
    Replies: 3
    Last Post: 5 Apr 2013, 1:50 AM
  5. [NOREPRO] [4.2] Store autoLoad=false ignored when remoteSort=true
    By dnoizet in forum Ext:Bugs
    Replies: 1
    Last Post: 28 Mar 2013, 6:34 AM

Posting Permissions

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