错误NodeStore没有模型

时间:2012-02-24 09:06:48

标签: extjs extjs4 extjs-mvc

我正在使用TreeGrid来显示一些数据。 自从我实现了treegrid以来,extjs一直在抛出这个错误:

没有型号定义的商店。您可能输错了型号名称。

我调试了一下并发现,这是因为有一个没有模型的“nodeStore”而被抛出。

这个“nodeStore”来自哪里,我做错了什么?

商店:

Ext.define('AM.store.AdvertiserStatistics', {
    extend: 'Ext.data.TreeStore',
    model: 'AM.model.AdvertiserStatistic',
    autoLoad: false,
    folderSort: true,
    startDate: new Date().getTime(),
    endDate: new Date().getTime(),
    nodeType: 'weekly',
    parentId: null,
    [..]

型号:

Ext.define('AM.model.AdvertiserStatistic', {
    extend: 'Ext.data.Model',
fields: [
    {
        name:'id',
        type:'int',
        useNull:true
    },
    'email',
    'clientname',
],
proxy:{
    type:'ajax',
    reader:{
        type:'json',
    root:'data'
    },
    api:{
    read:BASE_PATH + 'advertisers/index/stats:true/',
    destroy: BASE_PATH + 'advertisers/index/stats:true/'
    },
    base_api: {}
}
});

2 个答案:

答案 0 :(得分:0)

我唯一的猜测是你忘记将你的模型添加到MVC应用程序的模型集合中。您还可以尝试在商店中设置require属性。只需输入与模型属性相同的字符串。

Ext.define('AM.store.AdvertiserStatistics', {
    extend: 'Ext.data.TreeStore',
    model: 'AM.model.AdvertiserStatistic',
    require: 'AM.model.AdvertiserStatistic', //this!
    autoLoad: false,
    folderSort: true,
    startDate: new Date().getTime(),
    endDate: new Date().getTime(),
    nodeType: 'weekly',
    parentId: null,
    [..]

答案 1 :(得分:0)

我已经在其他地方回答了这个问题,但我认为对于那些进行调试的人来说,这个问题会更容易找到:

这是NodeStore中的一个错误。使用树面板时,您将始终看到这一点。

相关问题