Flex中如何利用expandItem()和expandChildrenOf()展开或关闭Tree的各层节点的例子

接下来的例子演示了Flex中如何利用expandItem()和expandChildrenOf()展开,或关闭Tree的各层节点。

让我们先来看一下Demo可以右键View Source或点击这里察看源代码):

下面是完整代码(或点击这里察看):



private function tree_expandItem(evt:MouseEvent):void {
if (tree.selectedItem && tree.dataDescriptor.isBranch(tree.selectedItem)) {
tree.expandItem(tree.selectedItem, checkBox.selected);
}
}

private function tree_expandChildrenOf(evt:MouseEvent):void {
if (tree.selectedItem && tree.dataDescriptor.isBranch(tree.selectedItem)) {
tree.expandChildrenOf(tree.selectedItem, checkBox.selected);
}
}





















代码:Peter deHaan 翻译/整理/编译:中文Flex例子

Leave a Reply

Your email address will not be published. Required fields are marked *