2012-02-24 54 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, 
    [..] 
相關問題