請你幫我休息一下。我希望我的商店成爲REST,我看到了一些使用HttpProxy的示例,並試圖做同樣的事情,但它無法工作。ExtJs將商店更改爲REST
正如我注意到在樣品商店總是創建像:var store = Ext.create ... 如果在這個問題,然後我不知道在哪裏調用Ext.create,以前我總是用storeId網格,它運作良好。
P.S.爲什麼沒有商店數據只有空白字段才能創建網格?
這裏是我的 'TestStore' 代碼:
Ext.define('MVC.store.Notes', {
extend : 'Ext.data.Store',
requires : [
'MVC.model.Note'
],
storeId : 'TestStore',
model : 'MVC.model.Note',
autoLoad: true,
proxy: {
type: 'rest',
url: 'rest/notes',
reader: {
type: 'json',
rootProperty: 'data'
},
writer: {
type: 'json'
}
}
});
和電網:
Ext.define('MVC.view.NotesGrid', {
extend: 'Ext.grid.Panel',
xtype: 'notesGrid',
title: 'Note-list',
// store: 'Notes',
store: 'TestStore',
columns: [
{
text: 'Name',
dataIndex: 'name',
flex: 1
},
{
text: 'Creation Date',
xtype: 'datecolumn',
format: 'd-m-Y',
dataIndex: 'createDate',
flex: 1
},{
text: 'Last Modified',
xtype: 'datecolumn',
format: 'd-m-Y',
dataIndex: 'modifiedDate',
flex:1
}, {
text: 'Text',
dataIndex: 'noteText',
flex: 3
}
]
});
從你的代碼片段,我不明白爲什麼它不應該工作。我想更多的細節是必需的(例如,究竟哪些工作不正常,您在瀏覽器控制檯中獲得哪些錯誤消息以及如何創建該商店的實例)。 – Alexander