1. #1
    Ext JS Premium Member kgmoney's Avatar
    Join Date
    Oct 2007
    Location
    Normal, IL
    Posts
    107
    Vote Rating
    0
    kgmoney is on a distinguished road

      0  

    Programmatically Select TreeNode

    Programmatically Select TreeNode


    Hi,

    I think this is simple question but I've been stuck on it for some time now. I have a treepanel and would like to be able to have a default selection. I first thought the selectPath method would be what I want, and that seems to work, but doesn't give any visual indication that a node is selected (highlighted). In the forums I have come accross references to node.ui.highlight() but that gives me 'Ext.fly(...) is null or not an object'.

    What I would like to see is my treepanel with a node selected just as if the user just clicked on it.

    Any help would be much appreciated.
    Kevin


    Ext Team: I am still very new to Ext but have been quite impressed, keep up the good work.

  2. #2
    Sencha User
    Join Date
    Oct 2007
    Posts
    155
    Vote Rating
    0
    thatcoder is on a distinguished road

      0  

  3. #3
    Ext JS Premium Member kgmoney's Avatar
    Join Date
    Oct 2007
    Location
    Normal, IL
    Posts
    107
    Vote Rating
    0
    kgmoney is on a distinguished road

      0  

    Default


    How witty...after a day of searching I figured I'd risk a question.
    At any rate thanks for the link it got me going in the right direction.

    For anyone else that reads this, function.defer() was what I needed.

    Something I am still curious about, however, is why I needed to defer the call to TreePanel.selectPath(). I am calling it in the TreePanel's render event after building the tree, why does it need a pause? Is there another event I should be using so that I don't have to defer...maybe the window's render event (the tree is in a window)?

    Thanks, kg

  4. #4
    Ext JS Premium Member cdomigan's Avatar
    Join Date
    Mar 2007
    Posts
    148
    Vote Rating
    1
    cdomigan is on a distinguished road

      0  

    Default


    Yes I'd like to know the same thing - we shouldn't have to use defer. I note that TreeNode has no "render" event we can monitor. Is there any other way we can automatically select a treenode upon the tree panel rendering?

  5. #5
    Sencha User
    Join Date
    Oct 2007
    Posts
    155
    Vote Rating
    0
    thatcoder is on a distinguished road

      0  

    Default


    Code:
    	if (Ext.getCmp('tree')) { // if tree is loaded
    		var tree = Ext.getCmp('tree');
    
    	    tree.on('append', function(tree, p, node){
    	       if(node.id == 9){ // select node
    	           node.select.defer(100, node);
    	       }
    	    });
             }

  6. #6
    Ext User
    Join Date
    Oct 2007
    Posts
    22
    Vote Rating
    0
    deepak is on a distinguished road

      0  

    Default


    This is just great. Let's defer all the processing...

  7. #7
    Sencha User
    Join Date
    Oct 2010
    Location
    Bangalore
    Posts
    50
    Vote Rating
    0
    smkkiran is on a distinguished road

      0  

    Question what in case of multiselectModel

    what in case of multiselectModel


    in MultiSelectModel its clearing all the selection model.......

  8. #8
    Sencha User
    Join Date
    Jul 2012
    Posts
    8
    Vote Rating
    0
    siddmuk2005 is on a distinguished road

      0  

    Default Solution of above question

    Solution of above question


    If you have node id then try to get the node by id and then use as follows

    taxonomyTreeLoader.on("load", function(){
    if(isQueryExecutable && singleParamDynamicQuery &&docTypeCodeDynamciQuery.length>0){
    var currentNode=taxonomyTree.getNodeById(docTypeNodeId);
    if(currentNode.isLeaf()){
    taxonomyTree.getSelectionModel().select(currentNode);
    taxonomyTree.fireEvent("click", currentNode);
    }
    }
    });


Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."