Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
extjs4-Can';无法在控制器中获取对我的存储的引用_Extjs_Controller_Store - Fatal编程技术网

extjs4-Can';无法在控制器中获取对我的存储的引用

extjs4-Can';无法在控制器中获取对我的存储的引用,extjs,controller,store,Extjs,Controller,Store,我无法在我的控制器中使用我的存储的getter。我必须使用全名('ExtMVC.store.Contatos'而不仅仅是'Contatos'),否则应用程序就会崩溃。。。但是使用全名,我不能使用框架(getContatosStore)生成的getter。这是我的控制器: controller/Contacts.js Ext.define('ExtMVC.controller.Contacts', { extend: 'Ext.app.Controller', models: ['Contato

我无法在我的控制器中使用我的存储的getter。我必须使用全名('ExtMVC.store.Contatos'而不仅仅是'Contatos'),否则应用程序就会崩溃。。。但是使用全名,我不能使用框架(getContatosStore)生成的getter。这是我的控制器:

controller/Contacts.js

Ext.define('ExtMVC.controller.Contacts', {
extend: 'Ext.app.Controller',

models: ['Contatos'],
stores: ['ExtMVC.store.Contatos'],
views: ['ContatosGrid'],
refs: [
    {
        ref: 'contatosgrid',
        selector: 'grid',
        xtype: 'gridpanel'
    }
],
init: function() {
    this.control({
        'contatosgrid dataview': {
            itemdblclick: this.editarContato
        },
        'contatosgrid button[action=add]': {
            click: this.editarContato
        },
        'contatosgrid button[action=delete]': {
            click: this.deleteContato
        },
        'contatoform button[action=save]': {
            click: this.updateContato
        }
    });
},
editarContato: function(grid, record) {
    var edit = Ext.create('ExtMVC.view.contato.Formulario').show();

    if (record) {
       edit.down('form').loadRecord(record);
    }
},
updateContato: function(button) {
    var win = button.up('window'),
        form = win.down('form'),
        record = form.getRecord(),
        values = form.getValues();

    var novo = false;

    if (values.id > 0) {
        record.set(values);
    } else {
        record = Ext.create('ExtMVC.model.Contato');
        record.set(values);
        this.getContatosStore().add(record);
        novo = true;
    }

    win.close();
    this.getContatosStore().sync();

    if (novo) { //faz reload para atualziar
        this.getContatosStore().load();
    }
},
deleteContato: function(button) {

    var grid = this.getContatosGrid(),
        record = grid.getSelectionModel().getSelection(),
        store = this.getContatosStore();

    store.remove(record);
    this.getContatosStore().sync();

    //faz reload para atualziar
    this.getContatosStore().load();
}
}))


我可以用它们的名字来声明视图和模型,一切正常。我还尝试在Application.js中声明我的商店,但没有成功。有什么建议吗?Tnx.

首先,使用短存储名称,而不是完整的类名。然后检查控制台输出是否有任何错误,如果有,则进行修复