0

我有一个有 50 条记录的网格。一旦网格被填充,我希望它在加载到特定表单时过滤记录。例如; 一旦加载,它应该显示所有 10 岁的学生。

这必须编码;我浏览了这个grid-filter-local.js例子,它展示了如何清除过滤器选项,而不是通过代码设置过滤器选项。我怎样才能做到这一点 ?

4

1 回答 1

1

类似的东西?

var st = Ext.getStore('MyStore');

st.clearFilter();
st.on('load', function() {
   st.filter({
       filterFn: function(rec) { return rec.get('age') > 10; }
   });
}, this, { single: true });
于 2012-07-07T23:48:11.230 回答