[Flex] 组件Tree系列 —— 将数组作为dataProvider
mxml:
<?xml version="1.0" encoding="utf-8"?> <!--功能描述:将数组作为dataProvider--> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"> <fx:Script>
<![CDATA[
protected function tree_labelFunction(item:Object):String
{
var num:String = "";
if (tree.dataDescriptor.hasChildren(item)) {
num = " (" + item.children.length + ")";
}
return item.label + num;
}
]]>
</fx:Script> <fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:Array id="data">
<fx:Object label="周星驰">
<fx:children>
<fx:Object label="1988">
<fx:children>
<fx:Object label="《霹雳先锋》香港票房8916612" />
<fx:Object label="《捕风汉子》香港票房3149395" />
<fx:Object label="《最佳女婿》香港票房5807710" />
</fx:children>
</fx:Object>
<fx:Object label="1989">
<fx:children>
<fx:Object label="《龙在天涯》香港票房6809853 " />
<fx:Object label="《义胆群英》香港票房7913329" />
<fx:Object label="《流氓差婆》香港票房5624622 " />
<fx:Object label="《风雨同路》香港票房9335299 " /> </fx:children>
</fx:Object>
</fx:children>
</fx:Object>
<fx:Object label="李连杰">
<fx:children>
<fx:Object label="1992">
<fx:children>
<fx:Object label="笑傲江湖之东方不败(1992)" />
<fx:Object label="黄飞鸿之二男儿当自强(1992)" />
<fx:Object label="黄飞鸿之三狮王争霸(1992)" />
</fx:children>
</fx:Object>
<fx:Object label="1993">
<fx:children>
<fx:Object label="方世玉Ⅱ万夫莫敌(1993) " />
<fx:Object label="倚天屠龙记之魔教教主(1993)" />
<fx:Object label="黄飞鸿之铁鸡斗蜈蚣(1993) " />
<fx:Object label="太极张三丰(1993) " /> </fx:children>
</fx:Object>
<fx:Object label="1993">
<fx:children>
<fx:Object label="新少林五祖(1994) " />
<fx:Object label="精武英雄(1994)" />
<fx:Object label="中南海保镖(1994) " />
<fx:Object label="给爸爸的信(1995) " />
</fx:children>
</fx:Object>
</fx:children>
</fx:Object>
</fx:Array>
</fx:Declarations> <mx:Tree id="tree" dataProvider="{data}" labelField="label" width="320" labelFunction="tree_labelFunction"/>
</s:Application>
[Flex] 组件Tree系列 —— 将数组作为dataProvider的更多相关文章
- [Flex] 组件Tree系列 —— 打开和关闭节点
mxm: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:打开和关闭节点--> < ...
- [Flex] 组件Tree系列 —— 运用variableRowHeight和wordWrap设置可变行高
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用variableRowHeig ...
- [Flex] 组件Tree系列 —— 作为PopUpButton的弹出菜单
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:Tree作为PopUpButton ...
- [Flex] 组件Tree系列 —— 支持元素的拖放排序
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持元素拖放排序--> &l ...
- [Flex] 组件Tree系列 —— 利用firstVisibleItem属性,设置或取得第一个显示节点
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述: 利用firstVisibleIt ...
- [Flex] 组件Tree系列 —— 运用LabelFunction hasChildren getChildren设置Tree包含节点个数
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用LabelFunction h ...
- [Flex] 组件Tree系列 —— 运用openItems获取打开节点
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:运用openItems获取打开节点 ...
- [Flex] 组件Tree系列 —— 支持CheckBox组件
主程序mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:支持CheckBox--&g ...
- [Flex] 组件Tree系列 —— 阻止用户点击选中Tree中分支节点
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:阻止用户点击选中Tree中分支节点 ...
随机推荐
- linux: sort排序数据 grep搜索数据
sort 1.sort filename 输出排序后的结果,默认按字符大小排序 2.-n 按数字排序(如果内容是数字的话) 3.-M 按月份排序(如果是三字符简写月份的话) 下面这个例子非常实用: g ...
- Java-汉字繁体拼音转换
import com.github.stuxuhai.jpinyin.ChineseHelper; import com.github.stuxuhai.jpinyin.PinyinFormat; i ...
- Mysql配置文件详解 my.cof
Mysql配置文件详解 # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.6/ ...
- SLAM Course - WS13/14 by Cyrill Stachniss (1) 课程资源汇总
本帖是作者学习SLAM 课程笔记的资源帖,汇总了SLAM Course - WS13/14 by Cyrill Stachniss 的相关资源. 1. 课程网站,有相关课件作业和教学视频下载. htt ...
- nginx在windows平台下的使用笔记
nginx主要提供反向代理及负载均衡的能力,重定向报文代理及报文数据替换也是常用功能.(参考https://www.cnblogs.com/fanzhidongyzby/p/5194895.html) ...
- [GO]百度贴吧的爬虫
package main import ( "fmt" "strconv" "net/http" "os" " ...
- [GO]文件的收发服务器
发送方 package main import ( "fmt" "os" "net" "io" ) //发送文件内容 f ...
- python操作mysql数据库系列-安装MySQLdb
一波三折,先是pip命令出现问题,然后各种方法尝试解决.然后是直接使用pip2命令安装报错,mysql-python库安装再次出现问题.于是使用国内镜像的方式去安装:pip2 install MySQ ...
- python列表技巧
1.访问列表元素 test1 = ["chengqian","and","what"] print(test1[0])#第一个元素 prin ...
- Currying and Uncurrying Js
//反科里化Function.prototype.uncurrying = function() { var _this = this; return function() { return Func ...