Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2007
    Location
    London, UK
    Posts
    143
    Vote Rating
    0
    albeva is infamous around these parts albeva is infamous around these parts

      0  

    Default [CLOSED-874] Tree nested node.select() method fails when given node is first rendered

    [CLOSED-874] Tree nested node.select() method fails when given node is first rendered


    ExtJS: 3.2 final
    OS: Windows 7 Pro 64bit
    Browser: Firefox 3.2, Chrome 4, IE6

    When I create a tree and load the data with preloadChildren enabled I cannot use select() method on a node to ensure its selection if the node is nested. Using ensureVisible() does show the node, but calling select() has no effect.
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    	<head>
    		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    		<title>Test</title>
    		
    		<!-- CSS -->
    		<link rel="stylesheet" href="resources/css/ext-all.css" type="text/css" media="screen" />
    
    		<!-- Javascript -->
    		<script src="ext-base-debug.js" type="text/javascript"></script>
    		<script src="ext-all-debug.js" type="text/javascript"></script>
    		
    		<script type="text/javascript">
    		//<![CDATA[
    			Ext.onReady(function(){
    				// simple window to test
    				new Ext.tree.TreePanel({
    					applyTo	: Ext.getBody(),
    					width	: 150,
    					height	: 200,
    					autoScroll: true,
    					loader	: new Ext.tree.TreeLoader({
    						preloadChildren: true
    					}),
    					root	: new Ext.tree.AsyncTreeNode({
    						expanded: false,
    						children: [{
    							id	: 'a',
    							text	: 'A',
    							leaf	: false,
    							children: [{
    								id	: 'b',
    								text	: 'B',
    								leaf	: false,
    								children: [{
    									id	: 'c',
    									text	: 'C',
    									leaf	: true
    								}]
    							}]
    						}]
    					}),
    					rootVisible: false,
    					listeners: {
    						afterrender : function(tree) {
    							var node = tree.getRootNode().findChild(
    								'id',
    								'c',
    								true
    							);
    							node.ensureVisible(function(node){
    								// node is NOT selected!
    								node.select();
    							});
    						}
    					}
    				});
    			});
    		//]]>
    		</script>
    	</head>
    	<body>
    		<noscript>This application requires JavaScript enabled browser.</noscript>
    	</body>
    </html>

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,655
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You need to set clearOnLoad: false on the tree loader. Otherwise the tree node reference gets overwritten during expandPath.

    Marking as closed.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1