错误 NodeStore 没有模型
我正在使用 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: {}
}
});
I'm using a TreeGrid to display some data.
Since I implemented the treegrid, extjs keeps throwing this error:
Store defined with no model. You may have mistyped the model name.
I debugged a bit and found out, that this is thrown because there is a "nodeStore" without model.
Where does this "nodeStore" come from and what am I doing wrong?
Store:
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,
[..]
Model:
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: {}
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经在其他地方回答过这个问题,但我认为对于像您一样进行调试的人来说,这个问题会更容易找到:
这是 NodeStore 中的一个错误。当您使用树面板时,您总是会看到这一点。
I've answered this elsewhere, but I think this question will be easier to find for people who do the debugging as you have:
This is a bug in NodeStore. You will always see this when you use a Tree Panel.
我唯一的猜测是您忘记将模型添加到 MVC 应用程序的模型集合中。您还可以尝试在商店中设置 require 属性。只需输入与模型属性相同的字符串即可。
The only guess I have - is that you forgot to add your model into the models collection of you MVC app. You could also try to set require property in your store. Just put the same string as for the model property.