我有一个使用MySQL数据库的远程商店。
这是商店定义
Ext.define('rgpd.store.sOutil', {
extend: 'Ext.data.Store',
requires: [
'rgpd.model.mOutil'
],
model: 'rgpd.model.mOutil',
autoLoad: true,
autoSync: true,
pageSize: 0,
remoteSort: true,
remoteFilter: true,
proxy: {
type: 'ajax',
api: {
create: 'data/app.php?class=Outil&action=create',
read: 'data/app.php?class=Outil&action=read',
update: 'data/app.php?class=Outil&action=update',
destroy: 'data/app.php?class=Outil&action=destroy',
},
reader: {
type: 'json',
root: 'data',
totalProperty: 'totalCount',
successProperty: 'success'
},
writer: {
type: 'json',
writeAllFields: false,
successProperty: 'success',
encode: true,
extraParams: "id",
idProperty: "id",
rootProperty: 'data'
}
}
});
我有一组id,我想要保留,所以我需要应用过滤器。 我发现了两种不同的解决方案,第一个是使用filtreBy method
Ext.getStore('sOutil').filterBy(function(record, id) {
return Ext.Array.contains(ids_intervenant_outils, record.get('id'));
});
我做了这个错误我在Firefox中收到错误“太多的递归”。所以我尝试了另一种方法,并在另一个堆栈溢出帖子(here)上找到了这个,但我ge Ext.escapeRe
根据firefox“不是函数”。我试图找到另一个我发现Ext.String.escapeRegex()
的函数,但我在Firefox中又出现了一个错误“p.replace不是函数”
var filterValue = Ext.isArray(ids_intervenant_outils)
? new RegExp('^(?:' + Ext.Array.map(ids_intervenant_outils, function(value){return Ext.String.escapeRegex(value)}).join('|') + ')$')
: values;
Ext.getStore('sOutil').clearFilter(false);
Ext.getStore('sOutil').filter('id', filterValue);
这里是太多的递归调用跟踪
RegExpGlobalReplaceOptFunc self-hosted:4702:22
[Symbol.replace] self-hosted:4499:24
replace self-hosted:5248:13
encodeString http://localhost/rgpd/extjs6/ext-all.js:22:383387
doEncode http://localhost/rgpd/extjs6/ext-all.js:22:382867
encodeObject http://localhost/rgpd/extjs6/ext-all.js:22:384535
doEncode http://localhost/rgpd/extjs6/ext-all.js:22:383117
encodeObject ...
答案 0 :(得分:0)
发现#34;过多的递归问题"错误。商店定义中remoteFilter: true
必须为remoteFilter: false,
。