在ExtJS API文档中查找过滤功能。在左上角的“查找类”中,您可以通过输入字符串过滤树。我认为您要做的与此非常相似:
http://dev.sencha.com/deploy/dev/docs/
向下滚动至
功能:
http://dev.sencha.com/deploy/dev/docs/resources/docs.js
filterTree: function(t, e){
var text = t.getValue();
Ext.each(this.hiddenPkgs, function(n){
n.ui.show();
});
if(!text){
this.filter.clear();
return;
}
this.expandAll();
var re = new RegExp('^' + Ext.escapeRe(text), 'i');
this.filter.filterBy(function(n){
return !n.attributes.isClass || re.test(n.text);
});
// hide empty packages that weren't filtered
this.hiddenPkgs = [];
var me = this;
this.root.cascade(function(n){
if(!n.attributes.isClass && n.ui.ctNode.offsetHeight < 3){
n.ui.hide();
me.hiddenPkgs.push(n);
}
});
},