Results 1 to 4 of 4

Thread: How to avoiad stores autoload TRUE when page system boot?

  1. #1
    Sencha User
    Join Date
    Apr 2013
    Posts
    45
    Answers
    1

    Default Answered: How to avoiad stores autoload TRUE when page system boot?

    Hi all,
    I am using Extj4+ MVC, I have one controller name "Accounts" this controller manage manay view pages and forms, and form has defferent kind of itemse.g, xtype combobox (list data from database) and all form item are load from dabase too,
    Code:
    Ext.define('Myapp.controller.Accounts', {
        extend: 'Ext.app.Controller',
        requires: ['Myapp.Utilities'],
        views: [
            'account.Add',
            'account.Edit',
            'account.List'
        ],
        stores: [ //Here many stores will be use
                  'Account','AccountList','User','Country',
                  'City','District','Commune',
                  'ShippingCity','ShippingDistrict',
                  'ShippingCountry', 'ShippingCommune',
                  'IspList','ServicePlan','AccountType',
                  'AssignTo','Industry'
       ],
        models: ['Account'],
        refs: [
            {
                ref  : 'accAdd',
                xtype:'accountAdd',
                selector: 'account-form-add',
                autoCreate :true
            },{
                ref  : 'accEdit',
                xtype:'accountEdit',
                selector: 'account-form-edit',
                autoCreate :true
            },{
                ref  : 'accList',
                xtype:'accountList',
                selector: 'account-form-list',
                autoCreate :true
            }
        ],
        
        init: function(application) {
              if(this.inited){
                    return;
              }
              this.inited = true;
            
              Myapp.Utilities.logShow =true; //Set to TRUE for development 
              this.application.on({
                 scope:this
              });
        }
    });
    Not:
    • Accounts controller auto execute when app.js is booting up, so all my stores are load automatic make my application slow performance.
    • I know because all my store files config autoLoad: true if set to false my app error because can't find store. How can i load store when i want without load when system boot?

  2. Quote Originally Posted by korndeang View Post
    Hi all,
    I am using Extj4+ MVC, I have one controller name "Accounts" this controller manage manay view pages and forms, and form has defferent kind of itemse.g, xtype combobox (list data from database) and all form item are load from dabase too,
    Code:
    Ext.define('Myapp.controller.Accounts', {
        extend: 'Ext.app.Controller',
        requires: ['Myapp.Utilities'],
        views: [
            'account.Add',
            'account.Edit',
            'account.List'
        ],
        stores: [ //Here many stores will be use
                  'Account','AccountList','User','Country',
                  'City','District','Commune',
                  'ShippingCity','ShippingDistrict',
                  'ShippingCountry', 'ShippingCommune',
                  'IspList','ServicePlan','AccountType',
                  'AssignTo','Industry'
       ],
        models: ['Account'],
        refs: [
            {
                ref  : 'accAdd',
                xtype:'accountAdd',
                selector: 'account-form-add',
                autoCreate :true
            },{
                ref  : 'accEdit',
                xtype:'accountEdit',
                selector: 'account-form-edit',
                autoCreate :true
            },{
                ref  : 'accList',
                xtype:'accountList',
                selector: 'account-form-list',
                autoCreate :true
            }
        ],
        
        init: function(application) {
              if(this.inited){
                    return;
              }
              this.inited = true;
            
              Myapp.Utilities.logShow =true; //Set to TRUE for development 
              this.application.on({
                 scope:this
              });
        }
    });
    Not:
    • Accounts controller auto execute when app.js is booting up, so all my stores are load automatic make my application slow performance.
    • I know because all my store files config autoLoad: true if set to false my app error because can't find store. How can i load store when i want without load when system boot?
    Do you have code that is expecting the store to exist with data on load? If so, you should rework your code to only leverage the store(s) when you have explicitly loaded them, or on one of the events of the store itself (e.g., load, etc.)

  3. #2
    Sencha User Stormseeker's Avatar
    Join Date
    Jan 2010
    Location
    Evanston, Illinois
    Posts
    59
    Answers
    3

    Default

    • Accounts controller auto execute when app.js is booting up, so all my stores are load automatic make my application slow performance.
    • I know because all my store files config autoLoad: true if set to false my app error because can't find store. How can i load store when i want without load when system boot?
    Setting autoLoad to false shouldn't throw an error. Which error are you getting? Perhaps remove the autoLoad configuration completely since the default is undefined (I.E. false).

  4. #3
    Sencha User existdissolve's Avatar
    Join Date
    Jan 2010
    Location
    Kansas
    Posts
    522
    Answers
    32

    Default

    Quote Originally Posted by korndeang View Post
    Hi all,
    I am using Extj4+ MVC, I have one controller name "Accounts" this controller manage manay view pages and forms, and form has defferent kind of itemse.g, xtype combobox (list data from database) and all form item are load from dabase too,
    Code:
    Ext.define('Myapp.controller.Accounts', {
        extend: 'Ext.app.Controller',
        requires: ['Myapp.Utilities'],
        views: [
            'account.Add',
            'account.Edit',
            'account.List'
        ],
        stores: [ //Here many stores will be use
                  'Account','AccountList','User','Country',
                  'City','District','Commune',
                  'ShippingCity','ShippingDistrict',
                  'ShippingCountry', 'ShippingCommune',
                  'IspList','ServicePlan','AccountType',
                  'AssignTo','Industry'
       ],
        models: ['Account'],
        refs: [
            {
                ref  : 'accAdd',
                xtype:'accountAdd',
                selector: 'account-form-add',
                autoCreate :true
            },{
                ref  : 'accEdit',
                xtype:'accountEdit',
                selector: 'account-form-edit',
                autoCreate :true
            },{
                ref  : 'accList',
                xtype:'accountList',
                selector: 'account-form-list',
                autoCreate :true
            }
        ],
        
        init: function(application) {
              if(this.inited){
                    return;
              }
              this.inited = true;
            
              Myapp.Utilities.logShow =true; //Set to TRUE for development 
              this.application.on({
                 scope:this
              });
        }
    });
    Not:
    • Accounts controller auto execute when app.js is booting up, so all my stores are load automatic make my application slow performance.
    • I know because all my store files config autoLoad: true if set to false my app error because can't find store. How can i load store when i want without load when system boot?
    Do you have code that is expecting the store to exist with data on load? If so, you should rework your code to only leverage the store(s) when you have explicitly loaded them, or on one of the events of the store itself (e.g., load, etc.)

  5. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    45
    Answers
    1

    Default

    I got it work, if autoload =false , when i want call i should
    Code:
    Ext.getCmp('AccountStore').load()
    need add load()

    Thanks your help!

Posting Permissions

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