zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    Codeforces 916E Jamie and Tree (换根讨论)
    BZOJ 3083 遥远的国度 (换根讨论 + 树链剖分)
    Codeforces 703D Mishka and Interesting sum(离线 + 树状数组)
    ECNU 3480 没用的函数 (ST表预处理 + GCD性质)
    HDU 4343 Interval query(贪心 + 倍增)
    Codeforces 147B Smile House(DP预处理 + 倍增)
    HDU 4870 Rating (高斯消元)
    TopCoder SRM 301 Div2 Problem 1000 CorrectingParenthesization(区间DP)
    Hrbust 2320 OX (博弈)
    Hrbust 2319 Number Game(贪心)
  • 原文地址:https://www.cnblogs.com/taobataoma/p/1033994.html
Copyright © 2011-2022 走看看