请你帮我休息一下。我希望我的商店成为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