girdPanel.load()后,用store.filter()过滤数据,没有用。
这是怎么回事。
[b]问题补充:[/b]
我做一个简单的例子,左边tree用于过滤数据,右边gird显示数据。
grid初期化load()后,紧接着用store.filter()过滤数据,结果没有变化。
点击tree其他节点,也用store.filter()过滤数据后,正常显示。
主要代码如下:
//点击tree事件
function menuSelected(node){
var dep = node.text;
var grid;
// grid,是否存在
if (Ext.getCmp('list')) {
// gird存在,根据节点过滤数据。
grid = Ext.getCmp('list');
grid.store.filter('dep',dep);
} else {
// 第一次点击tree节点,创建grid,并过滤数据。
grid = new listGridPanel({
id: 'list',
title: '员工信息一览',
stripeRows: true,
defaultSortable: true,
bodyStyle:'width:100%',
region: 'center',
height: 1000,
autoScroll: true
});
// 主面板添加grid.
centerTab.add(grid).show();
grid.store.load();
// 过滤数据,但是不好用。
grid.store.filter('dep',dep);
}
};