Search code examples
extjscomboboxextjs4extjs4.1

Extjs Combo - Set store load in render function or by click a button


        xtype: 'combo',
        id: 'example',
        triggerAction:  'all',
        forceSelection: true,
        editable:       false,
        allowBlank: false,
        fieldLabel:     'example',
        mode: 'remote',
        displayField:'name',
        valueField: 'id',
        store: Ext.create('Ext.data.Store', {
                        fields: [
                            {name: 'id'},
                            {name: 'name'}
                        ],
                        //autoLoad: false,
                        proxy: {
                            type: 'ajax',
                            url: 'example.php',
                            reader: {
                                type: 'json',
                                root: 'rows'
                            }
                        }
            }
        })
        ,listeners: {
            render: function(combo) {
                combo.store().load(); // not working
            }
        }

If i using autoload: true That work well. But I want to control my load and I using combo.store().load(); or Ext.getCmp('example').store.load(); in render function or by click a button. But everything not working.

How can i do that thanks


Solution

  • Use (component ref).getStore().load();

    like:

    Ext.getCmp('example').getStore().load(); 
    combo.getStore().load();