Opening nodes in a Flex Tree control using the expandItem() method
来源:互联网 发布:用友软件培训中心 编辑:程序博客网 时间:2024/05/18 11:36
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/11/29/opening-nodes-in-a-flex-tree-control-using-the-expanditem-method/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.events.ListEvent;
private function comboBox_change(evt:ListEvent):void {
var team:String = ComboBox(evt.currentTarget).selectedItem.@label;
var node:XMLList = mlb.league.division.team.(@label == team);
expandParents(node[0]);
tree.selectedItem = node[0];
var idx:int = tree.getItemIndex(node[0]);
tree.scrollToIndex(idx);
}
private function expandParents(node:XML):void {
if (node && !tree.isItemOpen(node)) {
tree.expandItem(node, true);
expandParents(node.parent());
}
}
]]>
</mx:Script>
<mx:XML id="mlb" source="mlb.xml" />
<mx:ApplicationControlBar dock="true">
<mx:ComboBox id="comboBox"
prompt="Please select a team..."
dataProvider="{mlb.league.division.team}"
labelField="@label"
change="comboBox_change(event);" />
</mx:ApplicationControlBar>
<mx:Tree id="tree"
dataProvider="{mlb}"
labelField="@label"
showRoot="false"
width="300"
rowCount="8" />
</mx:Application>
- Opening nodes in a Flex Tree control using the expandItem() method
- flex tree expandItem
- Resizing a Flex DataGrid control using the rowCount property
- Farthest Nodes in a Tree
- lightoj1094Farthest Nodes in a Tree
- Farthest Nodes in a Tree
- Farthest Nodes in a Tree
- Farthest Nodes in a Tree
- Changing the default skins on a Button control in Flex
- Listening for the link event in a Flex Label control
- Checkboxes in a Tree Control
- Removing items from a Flex DataGrid control using the DragManager class
- E - Farthest Nodes in a Tree
- E - Farthest Nodes in a Tree
- The method using the Chinese input method in Fedora 16
- Find the nearest common ancestor of any two nodes in a binary search tree
- Find the common ancestor of two nodes in a binary tree
- ch4.6: find the LCA of 2 nodes in a binary tree with 3 different methods
- 有关MiniGUI虚拟键盘实现的代码
- SQL 版本查询及对应关系
- 学习强制删除正在运行的文件
- #pragma
- 软件开发失败的经典
- Opening nodes in a Flex Tree control using the expandItem() method
- (转)MiniGUI 专栏
- MiniGUI 资源链接
- MFC让文档/视图结构程序支持滚动条
- 一眨眼
- js xml封装解析
- MailServer BL[Blacklist黑名单,包括RBL,CBL...] Check Website
- 真可以抓得住吗
- 探究JVM内存泄露