Re: 怎样为tree以及network 创建visible

var visibleFunc:Function = function(node:Node):Boolean{
if(node.getClient("demo") == null){
return true;
}
var text:String = textInput.text;
if(text == null){
return true;
}
text = StringUtil.trim(text);
if(text == ""){
return true;
}
if(node.name.toLocaleLowerCase().indexOf(text.toLocaleLowerCase()) >= 0){
return true;
}
var parent:IData = node.parent;
while(parent){
if(parent.name.toLocaleLowerCase().indexOf(text.toLocaleLowerCase()) >= 0){
return true;
}
parent = parent.parent;
}
return false;
};

tree.visibleFunction = visibleFunc;
network.visibleFunction = function(node:Node):Boolean{
if(node.childrenCount > 0){
return false;
}
return visibleFunc(node);
};

你可能感兴趣的:(Flex)