1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    22
    Vote Rating
    0
    Planet_x is on a distinguished road

      0  

    Default How to change clicked node of Ext TreePanel inside of an Ext Panel

    How to change clicked node of Ext TreePanel inside of an Ext Panel


    I am trying to change either the CSS or the text property of a clicked node inside my treepanel which is added to a regular ext panel. In my below code I define a treenode as the root node and append several child nodes to it. I then take all the treenodes and add them to a TreePanel which is added to my extjs panel containing all the treenodes. Is there anyway to change the css or text property of each item in the ext Panel so that when I click on one item it has say red text instead of the black text except all other items go back to black text. Not sure if this is the best way to do this either as I just have a large menu of "themes" but each one has its own items under it so this is why I have done it this way. Appreciate any assistance.

    Code:
     
     
    //Base Map Root Node
    var layer_Base_Root = new Ext.tree.TreeNode({
    cls: 'rootnode',
    text: "Base Maps",
    singleClickExpand: true,
    expanded: true
    });
     
    //Base Map Child 
    var layer_BaseMap_Child = new Ext.tree.TreeNode({
    text: "Base Map",
    cls: 'childnode',
    listeners: {
    click: function (node, event) {
    changeTheme(node.text, map, mapPanel, false);
    showMessage();
    }
    }
    });
     
    layer_Base_Root.appendChild(layer_BaseMap_Child);
     
     
    //Base Map Tree Panel
    var layerTree_Base = new Ext.tree.TreePanel({
    root: layer_Base_Root,
    rootVisible: true,
    preloadChildren: true
    });
     
    panel_Themes = new Ext.Panel({
    collapsed: false,
    height: 360,
    applyTo: 'themes',
    autoScroll: true,
    items: [layerTree_Base, other layer items after this]
    });
    


  2. #2
    jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    Frederick MD, NYC, DC
    Posts
    16,360
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    once you have the reference to the tree node, why not just call node.setText() ?

Similar Threads

  1. [OPEN-1103] IE8 TreePanel flashes when node clicked
    By aj3423 in forum Ext 3.x: Bugs
    Replies: 3
    Last Post: 18 Nov 2012, 11:08 PM
  2. How do I display the path to a clicked node in my TreePanel ?
    By kliphuis in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 12 Nov 2010, 2:44 PM
  3. Ext.TreePanel get a node.id to an other panel
    By Loader in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Mar 2010, 2:05 PM
  4. Collaspe all node except one which is clicked ext js tree
    By combay in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 29 Apr 2009, 10:47 PM

Thread Participants: 1