• [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>
  • 相关阅读:
    《淘宝网》为例,描述质量属性的六个常见属性场景
    《苏宁安全架构演进及实践》阅读总结
    《12306核心模型设计思路和架构设计》阅读心得
    放假个人总结七
    放假个人总结六
    放假个人总结五
    连接Oracle提示 ORA-28009: 应当以 SYSDBA 身份或 SYSOPER 身份建立 SYS 连接
    连接oracle无匹配协议
    CentOS 7下虚拟机没有网络
    CentOS 7安装时候没装ifconfig命令
  • 原文地址:https://www.cnblogs.com/frost-yen/p/4308820.html
Copyright © 2020-2023  润新知