我使用ExtJs的6.0.0 &煎茶Cmd的6.0.2和使用MVC架構,我有一個簡單的應用程序用於通過煎茶Cmd的像下面生成的測試:爲什麼我不能在ExtJs中使用商店的簡稱?
// MyApp的/存儲/ Personnel.js
Ext.define('MyApp.store.Personnel', {
extend: 'Ext.data.Store',
alias: 'store.personnel',
fields: [
'name', 'email', 'phone'
],
data: {
items: [{
name: 'Jean Luc',
email: "[email protected]",
phone: "555-111-1111"
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
rootProperty: 'items'
}
}
});
// MyApp的/應用/視圖/主/ List.js
Ext.define('MyApp.view.main.List', {
extend: 'Ext.grid.Panel',
xtype: 'mainlist',
requires: [
'MyApp.store.Personnel'
],
title: 'Personnel',
store: 'Personnel',
//store: {
// type: 'personnel'
//},
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email',
flex: 1
}, {
text: 'Phone',
dataIndex: 'phone',
flex: 1
}],
listeners: {
select: 'onItemSelected'
}
});
// MyApp的/應用/ application.js中
Ext.define('MyApp.Application', {
extend: 'Ext.app.Application',
name: 'MyApp',
stores: [
// TODO: add global/shared stores here
'Personnel'
]
});
它,我想用人員店(只與類名命名空間出來)的簡稱在列表的視圖中,但它不起作用。 但是在票務應用(Sencha官方也推薦在SDK中使用的例子)它使用這樣並且完美地工作,爲什麼我的工作不正常? app.json看起來像一樣。
嘗試在Application.js中添加全局/共享存儲的那一行... –
對不起,它在那裏,應該在那裏,我只在上面的帖子中有一個錯誤... – tft
你的意思是'它不起作用'?是否有一些錯誤?如果您沒有在網格中看到數據,請嘗試從數據中移除項目並將對象直接放入數據數組中。本地數據不使用代理。你的代碼應該沒有任何商店Id。 – yorlin