我尝试迁移到extjs4,但是'migration pack'返回massege'[BREAKING] [4.0] [Ext.data.Store]:指定了一个没有配置模型,url或字段的商店。有关正确设置数据组件的详细信息,请参阅Ext.data.Store的标题文档。这是一个无法在兼容性层中解决的重大变化!'
我的商店看起来像
Ext.namespace('App.data');
Ext.define('App.data.Store', {
extend: 'Ext.data.Store',
constructor: function(config) {
this.addEvents(
'beforeupdate'
);
this.callParent(this, config);
this.app_modFlag = false;
this.app_Updates = null;
this.on('load', function(store) {store.app_modFlag = false});
this.on('update', function(store) {store.app_modFlag = true});
this.on('add', function(store) {store.app_modFlag = true});
this.on('clear', function(store) {store.app_modFlag = true});
this.on('remove', function(store) {store.app_modFlag = true});
},
remoteSort: true,
/**
If true, object will automatically choose sort or local sort methods
depending of number of data pages
*/
autoChooseSortType: true,
/* Overriden methods */
load: function(options) {
options = options || {};
if (options.params && options.params.gridState && !isNaN(options.params.gridState.pageNo * options.params.gridState.pageSize)) {
options.params.start = options.params.gridState.pageNo * options.params.gridState.pageSize;
options.params.limit = options.params.gridState.pageSize;
}
if (options.params && options.params.gridState && options.params.gridState.sortField) {
options.params.sort = options.params.gridState.sortField;
options.params.dir = options.params.gridState.descendingOrder ? 'DESC' : 'ASC';
}
return App.data.Store.superclass.load.call(this, options);
},
loadRecords: function(o, options, success) {
if (this.autoChooseSortType && this.reader && !isNaN(this.reader.pageNumber) && this.reader.pageNumber > 0) {
this.remoteSort = this.reader.pageNumber > 1;
}
App.data.Store.superclass.loadRecords.call(this, o, options, success);
},
/**
Returns number of pages current server storage
Requires using of PagedListReader class as reader
*/
getPageNumber: function() {
return this.reader && !isNaN(this.reader.pageNumber) ? this.reader.pageNumber : Number.NaN;
},..........
.....................................................................................................................................................
Ext.define('AppRecord', { extend: 'Ext.data.Model',
fields: [
{name: 'appId'},
{name: 'name', sortType: Ext.data.SortTypes.asUCString},
{name: 'clientName', sortType: Ext.data.SortTypes.asUCString},
{name: 'creationTime', type: 'date'},
{name: 'stage', type: 'int'},
{name: 'type'}
]
});
var store = new App.data.Store({
proxy: new App.data.DwrProxy({
invoker: function(params, arg, cb) {
if (params.searchParams != null) {
AppManager.search(params.searchParams, params.gridState, cb);
} else if (params.removeId != null) {
AppManager.removeApp(params.removeId, params.gridState, cb);
} else {
AppManager.getAppList(params.gridState, null, cb);
}
}
}),
reader: new App.data.PagedListReader({
id: 'appId'
}, AppRecord),
sorters: App.util.makeSortInfo(App.appManager.gridState)
});
有什么想法吗?
答案 0 :(得分:0)
您忘了将模型分配到商店:
var store = new App.data.Store({
model: "AppRecord",//you need this added
proxy: new App.data.DwrProxy({
invoker: function(params, arg, cb) {
if (params.searchParams != null) {
AppManager.search(params.searchParams, params.gridState, cb);
} else if (params.removeId != null) {
AppManager.removeApp(params.removeId, params.gridState, cb);
} else {
AppManager.getAppList(params.gridState, null, cb);
}
}
}),
reader: new App.data.PagedListReader({
id: 'appId'
}, AppRecord),
sorters: App.util.makeSortInfo(App.appManager.gridState)
});