[CLOSED] Select node after expand in TreePanel

  1. #1

    [CLOSED] Select node after expand in TreePanel

    Good evening, I'm trying select a TreePanel's leaf after expand node (load ondemand) with this function:

    var SelectNode = function (path, serial) {
        var tree = Ext.getCmp("treeArchivi"),
              sm = tree.getSelectionModel(),
              node = tree.store.getNodeById(serial);
    
        if (node == undefined) {
            tree.expandPath(path);
        }
    
        node = tree.store.getNodeById(serial);
        console.log(node);
        if (node != undefined) {
            sm.select(node);
            App.direct.OpenArchivio(formatSerial(serial), node.data.text);
        }
    };
    but console.log(node); returns undefined.
    How can I resolve this issue?

    Thanks in advance
    Last edited by Daniil; Mar 17, 2014 at 12:55 PM. Reason: [CLOSED]
  2. #2
    Hi,

    You should check node in callback method which is passed to expandPath
    Please addtional info
    http://docs-origin.sencha.com/extjs/...hod-expandPath
    Vladimir Shcheglov
    Sr. Developer
  3. #3
    Thanks Vladimir works perfectly in this way, can mark as closed

    var ExpandNode = function (path, serial) {
    	var tree = Ext.getCmp("treeArchivi"),
    		node = tree.store.getNodeById(serial);
    
    	if (!path || (node != undefined)) {
    		SelectNode(serial);
    	} else {
    		tree.expandPath(path, null, '/', function (success, lastNode) {
    			if (success) {
    				setTimeout(function () {
    					SelectNode(serial);
    				}, 200);
    			}
    		}, this);
    	}
    };
    
    var SelectNode = function (serial) {
    	var tree = Ext.getCmp("treeArchivi"),
    		sm = tree.getSelectionModel(),
    		node = tree.store.getNodeById(serial);
    
    	if (node != undefined) {
    		sm.select(node);
    		App.direct.OpenArchivio(formatSerial(serial), node.data.text);
    	}
    };
    Last edited by multimediait; Mar 17, 2014 at 9:29 AM.

Similar Threads

  1. [CLOSED] Error when expand treepanel Node
    By AdminAISN in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 17, 2013, 7:13 PM
  2. Treepanel - Expand Node on Single Click - How to?
    By Tbaseflug in forum 2.x Help
    Replies: 1
    Last Post: Dec 12, 2012, 11:31 AM
  3. TreePanel expand node behaviour
    By web4u in forum 2.x Help
    Replies: 1
    Last Post: Aug 28, 2012, 1:02 PM
  4. [CLOSED] select node and expand parent nodes
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 13, 2011, 12:06 PM
  5. TreePanel node expand button IE8
    By methode in forum 1.x Help
    Replies: 8
    Last Post: Sep 08, 2009, 4:00 AM

Posting Permissions