1
我在filters
配置商店的指定的过滤器:ExtJS的4:动态存储滤波
Ext.define('Record', {
extend: 'Ext.data.Model',
fields: [{
name: 'value',
type: 'number'
}]
});
Ext.create('Ext.data.Store', {
id: 'store',
model: 'Record',
filters: [
function(item) {
return item.get('value') > 2;
}
],
sorters: [{
property: 'value',
direction: 'DESC'
}],
data: [{
value: 2,
}, {
value: 1
}, {
value: 3
}]
});
Ext.create('Ext.view.View', {
store: Ext.data.StoreManager.lookup('store'),
tpl: new Ext.XTemplate(
'<tpl foreach=".">',
'<div class="record">{value}</div>',
'</tpl>'
),
itemSelector: '.record',
emptyText: 'No records',
renderTo: Ext.getBody()
});
如果我显式调用filter()
在商店仅适用。 filterOnLoad
未设置,并且默认为true
,因此必须过滤商店。我如何保持商店始终过滤(每当执行任何CRU操作并加载后)?
接受你的答案。 –
@AkinOkegbile我不能明天。 –