Extjs 如何在单击按钮时加载存储

Extjs 如何在单击按钮时加载存储,extjs,load,store,Extjs,Load,Store,我在architect中制作了一个应用程序。我的店在这里 Ext.define('MyApp.store.storeMain', { extend: 'Ext.data.Store', requires: [ 'MyApp.model.modelMain' ], constructor: function(cfg) { var me = this; cfg = cfg || {}; me.callParent([Ext.apply({ autoL

我在architect中制作了一个应用程序。我的店在这里

Ext.define('MyApp.store.storeMain', {
extend: 'Ext.data.Store',
requires: [
    'MyApp.model.modelMain'
],

constructor: function(cfg) {
    var me = this;
    cfg = cfg || {};
    me.callParent([Ext.apply({
        autoLoad: false,
        storeId: 'storeMain',
        model: 'MyApp.model.modelMain',
        pageSize: 50,
        proxy: {
            type: 'ajax',
            reader: {
                type: 'json',
                root: 'Main',
                totalProperty: 'Main.totalCount'
            }
        }
    }, cfg)]);
}});
这是我的按钮:

{
                                xtype: 'button',
                                text: 'Submit',
                                listeners: {
                                    click: {
                                        fn: me.onButtonClick,
                                        scope: me
                                    }
                                }
这就是函数

onButtonClick: function(button, e, options) {
    storeMain.load({
        url:'test.json'
    })
}
                            },

但它并没有加载商店。相反,它给出了以下错误:未定义storeMain。我有一个viewport.js和其他文件,比如storeMain.js,任何地方都没有变量。您需要调用
Ext.getStore('storeMain')
以获取存储引用