这是我所拥有的:
单击其中一个框时,下面的列表将在服务器端进行过滤。
如果我选择网格中的行,然后提交过滤器,则会收到以下错误:
“getById 调用了本地缓存中不存在的 ID”
即使过滤器确实包含我选择的记录,也会出现这种情况。
这是模块:
Ext.define('NG.model.auxClasses.notifications.WhatsNew', {
extend: 'Ext.data.Model',
idProperty: 'iD',
autoLoad: true,
fields: [
{ name: 'iD', type: 'int' },
{ name: 'isActive', type: 'boolean' },
{ name: 'documentIdentifier', type: 'string' },
{ name: 'sourceSiteName', type: 'string' },
{ name: 'targetSiteName', type: 'string' },
{ name: 'createDate', type: 'date', dateFormat: 'c' },
{ name: 'businessArchiveEvent', type: 'string' },
{ name: 'businessArchive', type: 'string' },
{ name: 'previousWhatsNewEvents' },
{ name: 'isPin', type: 'boolean' },
{ name: 'IsDocumentReadByMe', type: 'boolean' },
{ name: 'isDocumentReadByOthers', type: 'boolean' },
{ name: 'documentYear', type: 'int' },
{ name: 'businessDirection', type:'int'}
],
// self association model
associations: [{
type: 'hasMany',
model: 'auxClasses.notifications.WhatsNew',
name: 'previousWhatsNewEvents',
primaryKey: 'id',
associationKey: 'previousWhatsNewEvents'
}],
proxy: {
type: 'rest',
url: 'api/WhatsNew/'
}
});
这里是商店:
Ext.define('NG.store.WhatsNews', {
extend: 'NG.store.AbstractStore',
model: 'NG.model.auxClasses.notifications.WhatsNew',
alias: 'store.whatsnewstore',
autoLoad:true,
buffered: true,
pageSize: 50
});
更新:
我跟着兔子到了洞里,发现了一个我不确定是否可行的解决方法:
这是我失败的地方:
refresh: function() {
...
// Don't need to do this on the first refresh
if (me.hasFirstRefresh) {
// Some subclasses do not need to do this. TableView does not need to do this.
if (me.refreshSelmodelOnRefresh !== false) {
me.selModel.refresh();
} else {
// However, even if that is not needed, pruning if pruneRemoved is true (the default) still needs doing.
me.selModel.pruneIf(); <<< HERE WE FAIL. THIS METHODS CALLS THE GET BY ID
}
}
...
}
所以在我看来,我添加了以下视图配置:
viewConfig: {
refreshSelmodelOnRefresh:true // Workaround : if this is not set to true when the grid will refresh and a record will be selected we will get an ext error
},
这已经解决了引发的错误,但我不确定最终结果以及它以后可能会造成什么伤害。
如果有人可以遮光...
有解决方法吗?