Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-9074 in a recent build.
  1. #1
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    560
    Vote Rating
    24
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default Combo with store triggers store load, without autoLoad

    Combo with store triggers store load, without autoLoad


    When a store is assigned to a Combo, the store is loaded, even though the store should not autoLoad.
    A filter is also applied, it includes the data-index av property, but no value.

    When the same store is assigned to more than one combo the store is loaded several times, each store ads a filter.

    Know issue?
    I've tested with several versions, latest is with 4.2.0.540
    Sven Tore Iversen

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,144
    Vote Rating
    855
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    This code:

    Code:
    var store = new Ext.data.Store({
        fields : ['text', 'value'],
        proxy  : {
            type : 'ajax',
            url  : 'data/json.json'
        }
    });
    
    new Ext.form.Panel({
        renderTo : document.body,
        items    : [
            {
                xtype        : 'combobox',
                fieldLabel   : 'Test',
                store        : store,
                displayField : 'text',
                valueField   : 'value'
            }
        ]
    });
    Using last night's nightly (also tested 4.2.0.489 = 4.2.0 RC1) it doesn't load the store until I click on the trigger or type in the box.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    560
    Vote Rating
    24
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    After some more testing I've found that you have to add set remoteFilter:true so see the problem.

    Still there in 625
    Sven Tore Iversen

  4. #4
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    560
    Vote Rating
    24
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    Is this marked as a bug?
    Sven Tore Iversen

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    53
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Quote Originally Posted by svenna View Post
    When a store is assigned to a Combo, the store is loaded, even though the store should not autoLoad.
    A filter is also applied, it includes the data-index av property, but no value.

    When the same store is assigned to more than one combo the store is loaded several times, each store ads a filter.

    Know issue?
    I've tested with several versions, latest is with 4.2.0.540
    It's an application error to use the same store in multiple combos.

    Obviously, each will add its own filter, so you really can't do this.

  6. #6
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    560
    Vote Rating
    24
    svenna has a spectacular aura about svenna has a spectacular aura about

      1  

    Default


    OK, but ignore the multiple combos, then.
    In 4.1 I could use the same store on multiple combos just fine.

    The error is there with just one combo.
    The problem, really, is that when the combo adds the filter to the store the store is loaded, even though the store is autoLoad:false if the store has remoteFilter:true.

    Why does the combo add a filter to the store? The filter data only contains a property, not a value. The value is not sent to the server as a part of the filter, it is sent as a query parameter.


    This code should NOT trigger a request:

    Code:
    <script type="text/javascript">
    	Ext.onReady(function(){
    
    		Ext.define('User', {
    			extend: 'Ext.data.Model',
    			fields: [
    				{name: 'login',  type: 'string'},
    				{name: 'name',   type: 'string'}
    			]
    		});
    
    		var store = new Ext.data.Store({
    			model:'User',
    			proxy: {
    				type: 'rest',
    				url: 'http://www.example.com/rest/users/',
    			},
    			remoteFilter: true,
    			autoLoad:false
    		});
    
    		var combo = new Ext.form.ComboBox({
    			renderTo:'combo',
    			store: store,
    			displayField:'name',
    			valueField:'login'
    		});
    	});
    </script>
    
    
    <div id="combo"></div>
    The above code trigger a request to:
    Code:
    http://www.example.com/rest/users/?_dc=1363019458867&page=1&start=0&limit=25&filter=%5B%7B%22property%22%3A%22name%22%7D%5D  
    
    _dc:1363019458867
    page:1
    start:0
    limit:25
    filter:[{"property":"name"}]
    When writing "test" in the combo it triggers:
    Code:
    _dc:1363019723543
    query:test
    page:1
    start:0
    limit:25
    filter:[{"property":"name"}]
    The later is "ok" although i would prefer if "test" was a value property in the filter to allow it to use the same filtering logic as all other store filters.

    Is this really the intended behavior?
    It triggers to many problematic request for the backend. The server does not currently accept "filter" with only property and no "value". Also sending "all data" for every combo using the same data on opening the application is simply to slow. In my application the user will always search, and the store always gets additional filters before they are loaded.
    Sven Tore Iversen

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    53
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Yes, I see.

    It adds the filter just for future use. It's disabled so it should not cause any immediate effect.

    I will add a ticket.

  8. #8
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,505
    Vote Rating
    53
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    This will be fixed in 4.2.1, but as a workaround, try this override:

    Code:
    Ext.override(Ext.data.Store, {
        filter: function(filters, value) {
            if (Ext.isString(filters)) {
                filters = {
                    property: filters,
                    value: value
                };
            }
    
            var me = this,
                decoded = me.decodeFilters(filters),
                i,
                doLocalSort = me.sorters.length && me.sortOnFilter && !me.remoteSort,
                length = decoded.length,
                allDisabled = true;
    
            // Merge new filters into current filter set.
            for (i = 0; i < length; i++) {
                me.filters.replace(decoded[i]);
            }
    
            // Cheack that we have some enabled filters before attempting to filter     
            for (i = 0, length = me.filters.items.length; i < length; i++) {
                if (!me.filters.items[i].disabled) {
                    allDisabled = false;
                    break;
                }
            }
            if (!allDisabled) {
                if (me.remoteFilter) {
                    // So that prefetchPage does not consider the store to be fully loaded if the local count is equal to the total count
                    delete me.totalCount;
    
                    // For a buffered Store, we have to clear the prefetch cache because the dataset will change upon filtering.
                    // Then we must prefetch the new page 1, and when that arrives, reload the visible part of the Store
                    // via the guaranteedrange event
                    if (me.buffered) {
                        me.data.clear();
                        me.loadPage(1);
                    } else {
                        // Reset to the first page, the filter is likely to produce a smaller data set
                        me.currentPage = 1;
                        //the load function will pick up the new filters and request the filtered data from the proxy
                        me.load();
                    }
                } else {
                    /**
                    * @property {Ext.util.MixedCollection} snapshot
                    * A pristine (unfiltered) collection of the records in this store. This is used to reinstate
                    * records when a filter is removed or changed
                    */
                    if (me.filters.getCount()) {
                        me.snapshot = me.snapshot || me.data.clone();
    
                        // Filter the unfiltered dataset using the filter set
                        me.data = me.snapshot.filter(me.filters.items);
    
                        // Groups will change when filters change
                        me.constructGroups();
    
                        if (doLocalSort) {
                            me.sort();
                        } else {
                            // fire datachanged event if it hasn't already been fired by doSort
                            me.fireEvent('datachanged', me);
                            me.fireEvent('refresh', me);
                        }
                    }
                }
            }
            me.fireEvent('filterchange', me, me.filters.items);
        }
    });

  9. #9
    Touch Premium Member svenna's Avatar
    Join Date
    Jun 2007
    Location
    Oslo,Norway
    Posts
    560
    Vote Rating
    24
    svenna has a spectacular aura about svenna has a spectacular aura about

      0  

    Default


    Thanks.. Initial testing of the override seems to do the trick - Also working fine (afaik) with using the same store on multiple combos (In my case they should always display the same data, even if it is filtered etc)
    Sven Tore Iversen

  10. #10
    Sencha User ngrover's Avatar
    Join Date
    Jun 2007
    Location
    Calgary Alberta Canada
    Posts
    24
    Vote Rating
    3
    ngrover is on a distinguished road

      0  

    Default


    I had the same issue described with the store loading on my combo's with remoteFilter:true. I applied the patch and that issue was resolved. However...

    I have grids with the following settings on their store:
    remoteSort:true,
    remoteGroup:true,
    remoteFilter:true,

    - In ExtJS 4.1.1 I would manually load my grids and autoLoad wasn't set or was set to false
    - In ExtJS 4.2.0 my grid now auto loads (causing a double initial load in my case).

    If I set all three remote options to false (and only then), then the store does not auto load as I had come to expect in ExtJS 4.1.1