1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    33
    Vote Rating
    0
    imnilesh is on a distinguished road

      0  

    Default Unanswered: Combo box store 'autoLoad' usage in MVC architecture.

    Unanswered: Combo box store 'autoLoad' usage in MVC architecture.


    I have a small application using MVC architecture.


    I have a button that launches a window having a combobox(Ext.form.field.Combobox). Aim is to keep the combobox store loaded with data once the window is loaded with form fields(including the combobox). All the form values are also loaded dynamically.


    I do not want to use queryMode: 'remote' since it will take quite some time to load when combobox is clicked.


    I tried using two ways with autoLoad=true option:


    1. Explicitly load the store once the form is loaded successfully:


    Code:
    form.load({
        url: '/a/b/c',
        success: function(form, action){
            var ostypeCombo = window.down('combobox');//finding the combobox object
            ostypeCombo.store.load();
        },
        failure: function(){
            alert('failure');
        }
    });
    2. Keep the store ready with data and associate it with combobox in it's init() method:


    Code:
       Ext.define('AM.view.comboItem’' ,{
           extend: 'Ext.form.ComboBox',
           alias : 'widget.comboItem’',    
           xtype: 'combobox',
           
           //store: 'Ostypes', /* this will not work as store is not available during loading */
    
           initComponent: function(arguments) {
           	   this.store = Ext.getStore('comboStore');
               this.callParent(arguments);
           }
       });
    I found that I cannot use above commented configuration as the store is not yet created during load time of the view.
    Is there any other better way to do this?

    Thanks.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,912
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    You could use bindStore:

    Code:
    Ext.define('MYAPP.view.field.MyCombo', {
        extend : 'Ext.form.field.ComboBox',
        alias  : 'widget.myapp-mycombo',
    
        ..
    
        initComponent : function () {
            var me = this;
    
            ..
    
            me.callParent(arguments);
        },
    
        bindStore : function (store, bool) {
            if (typeof store === 'string') {
                store = new MYAPP.store.MyStore(); // defined in controller:stores
            }
    
            MYAPP.view.field.MyCombo.superclass.bindStore.call(this, store, bool);
        }
    });
    Scott.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    33
    Vote Rating
    0
    imnilesh is on a distinguished road

      0  

    Default Combo box store 'autoLoad' usage in MVC architecture

    Combo box store 'autoLoad' usage in MVC architecture


    Thanks Scott. That seems like a better approach.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi