Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-9074 in a recent build.
  1. #11
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,508
    Vote Rating
    58
    Animal has a spectacular aura about Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Grids have not changed to do that. Can you show some code?

  2. #12
    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


    Hmm.. the difference between 4.1.1 and 4.2.0 only appears in my production application. I just tried to create a simplified grid outside my application that exhibits the problem... but cannot. There is something deeper going on. If I can pinpoint something resembling a bug in ExtJS that is causing this behaviour in my production app, then I'll post my findings.

    Thanks!

  3. #13
    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 haven't completely solved my problem but I've discovered a change in AbstractStore.js that is causing the difference in my app between 4.1.1 and 4.2.0

    If I have this on my store:
    Code:
    remoteSort:true,
    remoteGroup:true,
    remoteFilter:true,
    and this on my grid:
    Code:
    stateful: true,
    Then my grid will auto-load when I don't intend it to. When looking at AbstractStore.js, I see that it now over-rides applyState. In the override I found this (line 1060):

    Code:
    // Data manipulated by the server - reload
    if (me.remoteSort || me.remoteGroup || me.remoteFilter) {
      me.reload();
    }
    If I comment out the "me.load();" then my grids work like they did in 4.1.1 including state.

    I'll work on a test case but thought I'd update this post while these findings are still fresh in my head.

  4. #14
    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


    Here we go. I hacked a quick test script. This test loads the store automatically when it shouldn't.

    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId: 'test-store-id',
        model: 'TestModel',
        proxy: {
            type: 'rest',
            url: '/test',
            reader: {
                type: 'json',
                root: 'items'
            }
        },
        remoteSort:true,
        remoteGroup:true,
        remoteFilter:true,
        autoLoad: false
    });
    
    
    var grid = Ext.create('Ext.grid.Panel', {
        title: 'Test Grid',
        store: store,
        stateful: true,
        stateId: 'test-state-id-0',
        columns: [
            { text: 'test',  dataIndex: 'test' }
        ],
        listeners: {
            render: function(comp) {
                comp.getStore().load();
            }
        },
        renderTo: Ext.getBody()
    });

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

      0  

    Default


    Ah, yes. Statefulness of stores is new.

    Probably that should only do the load if autoLoad is truthy.

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

      0  

    Default


    You have a render listener which explicitly loads...

  7. #17
    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


    Right, which is what I have in my production code.... which is now loading twice on render. Once because I explicitly load on render, and once because of the fore-mentioned changes to 4.2.0.

    Try this sample without the explicit render and autoLoad:false and you should see that the grid's store autoLoads:

    Code:
    var store = Ext.create('Ext.data.Store', {
        storeId: 'test-store-id',
        model: 'TestModel',
        proxy: {
            type: 'rest',
            url: '/test',
            reader: {
                type: 'json',
                root: 'items'
            }
        },
        remoteSort:true,
        remoteGroup:true,
        remoteFilter:true,
        autoLoad: false
    });
    
    
    var grid = Ext.create('Ext.grid.Panel', {
        title: 'Test Grid',
        store: 'test-store-id',
        stateful: true,
        stateId: 'test-state-id-0',
        columns: [
            { text: 'test',  dataIndex: 'test' }
        ],
        renderTo: Ext.getBody()
    });
    As a side note: the reason I am doing my load on render is because I have some additional params and logic that I'd like to do when loading the store.
    Last edited by ngrover; 14 Mar 2013 at 3:04 PM. Reason: Additional information

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

      0  

    Default


    I can't get it to do that. It does not load for me. Unless I change that autoLoad config to true.

  9. #19
    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


    Well now that is odd It auto-loads for me with the last example code. The hunt continues. Thanks Animal.

  10. #20
    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


    Ok, this is driving me NUTS.

    I deleted my browser cookies/history. Then ran my own sample code again (see above) and everything worked (the store was not auto loading). I then SORTED the "test" column and reloaded the page. It was back to autoLoading when it shouldn't be. Ok, stay with me here...

    I've been running these code samples within the context of my application, so naturally I started wondering if I had a sneaky little over-ride somewhere or some external reason specific to my application as to why I noticed this issue. So I decided to create a test page that I could run outside of my application.

    Here is the html page I created. I dropped it into the "extjs/examples" folder (no modifications should be necessary) and ran it outside the context of my application (vanilla ext 4.2.0). I tested this file in my browser running on a server AND from the file system. They both exhibit the same issue. That is, if I load the page then initially everything is fine. If I then SORT the "test" column and reload the page, then it will autoLoad the store (not what I expected and not what it was doing under 4.1.1). I used firefox and firebug to see the ajax requests.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <script type="text/javascript" src="../ext-all-debug.js"></script>
        <link rel="stylesheet" type="text/css" href="../resources/css/ext-all-debug.css" />
    </head>
    <body>
      <script type="text/javascript"> 
      if (Ext.supports.LocalStorage) {
        Ext.require('Ext.state.LocalStorageProvider', function () {
          Ext.state.Manager.setProvider(new Ext.state.LocalStorageProvider());
        });
      } else {
        // use the cookie state provider for basic state management
        Ext.require('Ext.state.CookieProvider', function () {
          Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
    	expires: new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 30)) //30 days
          }));
        });
      }
      
      Ext.onReady(function() {
        var store = Ext.create('Ext.data.Store', {
    	storeId: 'test-store-id',
    	model: 'TestModel',
    	proxy: {
    	    type: 'rest',
    	    url: '/test',
    	    reader: {
    		type: 'json',
    		root: 'items'
    	    }
    	},
    	remoteSort:true,
    	remoteGroup:true,
    	remoteFilter:true,
    	autoLoad: false
        });
    
    
        var grid = Ext.create('Ext.grid.Panel', {
    	store: store,
    	stateful: true,
    	stateId: 'test-state-id-1',
    	columns: [
    	    { text: 'id',  dataIndex: 'id' }
    	]
        });
        grid.render(Ext.getBody());
      });
      </script>
    </body>
    </html>