zoukankan      html  css  js  c++  java
  • [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>
  • 相关阅读:
    win10 安装cmake报错: "Installation directory must be on a local drive"
    python量化笔记16之夏普比率计算公式
    python机器量化之十七:混淆矩阵(confusion_matrix)含义
    使用Aspose.word (Java) 填充word文档数据
    python笔记(十八)机器量化分析—数据采集、预处理与建模
    js 使FORM表单的所有元素不可编辑的示例代码 表
    Web前端面试题:写一个mul函数
    vue + electron 快速入门
    Java新特性stream流
    mycat中间件进行MySQL数据表的水平拆分
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4308820.html
Copyright © 2011-2022 走看看