1. #1
    Sencha User
    Join Date
    Jan 2008
    Posts
    45
    Vote Rating
    0
    netslayer is on a distinguished road

      0  

    Default Answered: How to stop stores from autoloading with MVC

    Answered: How to stop stores from autoloading with MVC


    I have a store defined with autoLoad: false but when using the MVC application approach they seem to autoload during the application initiation. Any ideas on how to stop this?

    Here is a code sample chopped down.

    Code:
    Ext.define('V.store.Properties', {
        extend: 'Ext.data.Store',
        model: 'V.model.Property',
        autoLoad: false,
        pageSize: 999,
        proxy: {
            type: 'ajax',
            url: '...endPoint',
            reader: {
                type: 'json',
                root: 'data',
                totalProperty: 'totalCount',
                idProperty: 'id'
            }
        }
    });
    
    Ext.define('V.controller.Properties', {
        extend: 'Ext.app.Controller',
    
        stores: [
          'Properties'
        ],
    
        views: [
            'property.Grid'
        ],
    
        models: [
            'Property'
        ]
    });
    
    Ext.define('V.view.property.Grid', {
        extend: 'Ext.grid.Panel',
        store: 'Properties'
    });
    
    var v = Ext.create('Ext.app.Application', {
            name: 'V',
            appFolder: 'app',
            controllers: [
                'Properties'
            ],
    
            launch: function() {
            // more code here that creates an instance of V.view.property.Grid
            }
    });

  2. Looking at the source for Ext.app.Application (which is where the stores you specify in a Controller get created), the getStore method doesn't do anything to auto load a Store.

    Code:
        getStore: function(name) {
            var store = Ext.StoreManager.get(name);
    
            if (!store) {
                store = Ext.create(this.getModuleClassName(name, 'store'), {
                    storeId: name
                });
            }
    
            return store;
        }
    If the Store is actually firing the load method, it would be because the StoreManager is falsely doing it but I personally haven't seen this behavior in my 4.x applications.

  3. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    4,770
    Answers
    355
    Vote Rating
    165
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    Do you use the guaranteeRange method of your store at any point? I had set up a buffered store and used guaranteeRange and that performs a load action in the store. I might be way off.

  4. #3
    Sencha User
    Join Date
    Jan 2008
    Posts
    45
    Vote Rating
    0
    netslayer is on a distinguished road

      0  

    Default


    nope, not using that.

  5. #4
    Sencha User mberrie's Avatar
    Join Date
    Feb 2011
    Location
    Bangkok, Thailand
    Posts
    507
    Answers
    26
    Vote Rating
    14
    mberrie will become famous soon enough mberrie will become famous soon enough

      0  

    Default


    How good are you with the debugger? Set a breakpoint in Store#load() or by adding 'debugger' in the JS code.

    Then trace back the call stack (the class/method that made the call to Store#load) and see where the method call comes from. That might help you understand what is going on.

  6. #5
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    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


    Looking at the source for Ext.app.Application (which is where the stores you specify in a Controller get created), the getStore method doesn't do anything to auto load a Store.

    Code:
        getStore: function(name) {
            var store = Ext.StoreManager.get(name);
    
            if (!store) {
                store = Ext.create(this.getModuleClassName(name, 'store'), {
                    storeId: name
                });
            }
    
            return store;
        }
    If the Store is actually firing the load method, it would be because the StoreManager is falsely doing it but I personally haven't seen this behavior in my 4.x applications.
    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.

  7. #6
    Sencha User bt_bruno's Avatar
    Join Date
    Mar 2008
    Location
    Redwood City, CA
    Posts
    154
    Answers
    11
    Vote Rating
    10
    bt_bruno will become famous soon enough

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Looking at the source for Ext.app.Application (which is where the stores you specify in a Controller get created), the getStore method doesn't do anything to auto load a Store.
    ...
    The getStore method instantiates the store by doing "store = Ext.create(...)". This fires the loading if autoLoad = true.

    I've seen this same behavior occurring and what I'm doing is avoiding autoLoad and doing something like this into my views:

    Code:
    initComponent: function() {
    	// ...
    	this.callParent(arguments);
    	this.store.load();
    }
    This way I have store loaded once my view is instantiated, and not when the store is instantiated at application beginning.

    Cheers!

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar