Results 1 to 3 of 3

Thread: How can I specify explicitly on expansion of a particular node by the user

  1. #1

    Default How can I specify explicitly on expansion of a particular node by the user

    Hi,

    It expands all the nodes in the tree. How can I specify explicitly on expansion of a particular node by the user, the action should happen.

    Please provide some pointers to this problem.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,256

    Default

    Code:
    myTree.on('expandnode', function(node)
    {
       if (node.id == 1)
       {
          //do something special
       }
    }
    );

  3. #3

    Default 11

    Thanks for your help!
    But I Know,How can I specify explicitly on expansion of a particular node by the user when tree render.

    HTML Code:
    Ext.onReady(function() {
    		    // shorthand
    		    //Ext.QuickTips.init();
    		    var Tree = Ext.tree;
    
    		    var tree = new Tree.TreePanel({
    		        el:'treeBox',
    		        border : false,
    		        autoScroll:true,
    		        animate:true,
    		        rootVisible:false,
    		        enableDD:true,
    	          //selModel: new Ext.tree.MultiSelectionModel(),
    		        containerScroll: true,
    		        loader: new Tree.TreeLoader(),
    		        collapseFirst:false
    			});
    
    		    // set the root node
    		    //var root = new Tree.TreeNode(
    		    var root = new Tree.AsyncTreeNode(
    		    //{text: 'Tree',allowDrop:false,id:'D10'}
    		    <c:out value='${treeNode}' escapeXml='false' />
    		    );
    
    		    /*
    		    var json = [<c:out value='${treeNode}' escapeXml='false' />];
    
    			for(var i = 0, len = json.length; i < len; i++) {
            		root.appendChild(tree.getLoader().createNode(json[i]));
        		}
        		*/
    
    
    		    tree.setRootNode(root);
    
    		    tree.render();
    		    //tree.expandAll();
    
    
    		    /*
    		    var CallBackHandler = {success: handleExpand};
    
    			function handleExpand() {
    				var n = tree.getNodeById("D10");
    				alert(n);
    				if (n !== undefined) {
    					this.tree.getLoader ().load (n);
    					n.expand (true, true);
    				}
    			}
    			*/
    
    
    		    //root.expand(false,false,CallBackHandler);
    		    //root.expand(false,false,handleExpand);
    			root.expand(false, false, function() {
    				root.firstChild.expand(false);
    			});
    
    			tree.on('beforenodedrop', doDrop);
    		    tree.on('click', doClick);
    
    		    root.on('expandnode', function(node) {
    		    	alert(node.id);
       				if (node.id == "DELETE") {
          				alert("1");
       				}
    			});
    
    		    Ext.get('expand').on('click', function() {
    				tree.expandAll();
    			});
    
    			Ext.get('collapse').on('click', function() {
    				tree.collapseAll();
    			});
    		});

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •