Using the itemDoubleClick event to open nodes in a Flex Tree control

简介:

  The following example shows how you can use the itemDoubleClick event to open the selected Tree node in Flex.

<? xml version="1.0" encoding="utf-8" ?>
<!--  http://blog.flexexamples.com/2007/11/29/using-the-itemdoubleclick-event-to-open-nodes-in-a-flex-tree-control/  -->
< mx:Application  xmlns:mx ="http://www.adobe.com/2006/mxml"
        layout
="horizontal"
        verticalAlign
="middle"
        backgroundColor
="white"
        creationComplete
="init();" >

    
< mx:Script >
        
<![CDATA[
            import mx.events.ListEvent;

            private function tree_itemDoubleClick(evt:ListEvent):void {
                var node:XML = tree.selectedItem as XML;
                var isOpen:Boolean = tree.isItemOpen(node);
                tree.expandItem(node, !isOpen);
            }
        
]]>
    
</ mx:Script >

    
< mx:XMLListCollection  id ="xmlListColl" >
        
< mx:source >
            
< mx:XMLList >
                
< node  label ="One" >
                    
< node  label ="One.1" >
                        
< node  label ="One.1.1" >
                            
< node  label ="One.1.1.1" >
                                
< node  label ="One.1.1.1.1"   />
                            
</ node >
                        
</ node >
                    
</ node >
                    
< node  label ="One.2"   />
                    
< node  label ="One.3"   />
                
</ node >
                
< node  label ="Two" >
                    
< node  label ="Two.1"   />
                    
< node  label ="Two.2"   />
                    
< node  label ="Two.3"   />
                
</ node >
                
< node  label ="Three"   />
            
</ mx:XMLList >
        
</ mx:source >
    
</ mx:XMLListCollection >

    
< mx:ApplicationControlBar  dock ="true" >
        
< mx:CheckBox  id ="checkBox"
                label
="doubleClickEnabled:"
                labelPlacement
="left"
                selected
="true"   />
    
</ mx:ApplicationControlBar >

    
< mx:Tree  id ="tree"
            dataProvider
="{xmlListColl}"
            labelField
="@label"
            width
="250"
            rowCount
="6"
            doubleClickEnabled
="{checkBox.selected}"
            itemDoubleClick
="tree_itemDoubleClick(event);"
            showScrollTips
="true"   />

</ mx:Application >


    本文转自 OldHawk  博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2008/01/10/1033994.html ,如需转载请自行联系原作者


相关文章
|
8月前
|
机器学习/深度学习 自然语言处理 算法
TABs(Type Abstraction,类型抽象):Open Relation and Event Type Discovery with Type Abstraction论文解读
传统的“封闭世界”信息提取(IE)方法依赖于人类本体来定义抽取范围。因此,当应用到新的领域时,这种方法就不适用了。这就要求系统能够从给定的语料库中自动推断出新的类型
43 0
|
JavaScript
click group list in left launchpad
click group list in left launchpad
102 0
click group list in left launchpad
custom field further usage - add into UI and report
custom field further usage - add into UI and report
113 0
custom field further usage - add into UI and report
Identify the logic how BOL node name is categorized into different object type
Identify the logic how BOL node name is categorized into different object type
108 0
Identify the logic how BOL node name is categorized into different object type
Modify text in webclient ui - persistent mode
Modify text in webclient ui - persistent mode
Modify text in webclient ui - persistent mode

热门文章

最新文章