2012-02-24 52 views
1

我正在使用TreeGrid来显示一些数据。 由于我实施了treegrid,extjs一直抛出这个错误:错误NodeStore没有模型

存储没有定义模型。您可能错误输入了型号名称。

我调试了一下,发现这是因为没有模型的“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: {} 
} 
}); 
+0

您是否在商店中设置了模型属性?请分享商店声明的代码 – 2012-02-24 09:09:47

+0

请参阅我的代码。我的数据正确加载,但我很好奇这个错误来自哪里。 – 2012-02-24 09:22:00

+0

在这里看到我的答案: http://stackoverflow.com/questions/9293511/how-to-specify-model-name-in-store-of-an-extjs-4/9295119#9295119 – 2012-02-24 13:01:05

回答

0

我已经回答了其他地方,但我认为这个问题会更容易找到人谁做你有调试:

这是NodeStore的错误。当你使用树面板时,你会一直看到这个。

+0

是否有票或者为了保持我自己的更新? – 2012-02-24 16:49:32

+0

我不确定是否有一个。你可以在Ext论坛上查看。我在很大程度上忽视了这个问题,因为它实际上并不有害。 – 2012-02-24 17:25:04

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, 
    [..] 
相关问题