The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

How do I set the text of a TreePanel node in JavaScript?

  1. #1

    How do I set the text of a TreePanel node in JavaScript?

    I have added a child node to the TreePanel using appendChild.

    selectedNode.appendChild(
    {
    
    text: 'Node 1',
    leaf: true,
    iconCls: '#Briefcase'
    }
    How can I then change this text once its been added?

    I have tried the following but the node text doesn't update until I expand/collpase the parent :

    selectedNode.data.text = 'New Text';
    selectedNode.set('title', 'New Text');
    selectedNode.set("text", 'New Text');
    treePanel.store.update();
    Is there another way to force the change?
  2. #2
    Hello @paulschofield!

    The last option you are trying to use looks right. But you didn't provide a runnable test case, all I can do is test with what we have; and I chosen the TreePanel basic example.

    There, if I just run App.TreePanel1.getRootNode().getChildAt(0).set('text', 'Bach');, I have the node updated correctly.

    You can try by yourself in the example. If you can show the issue or the scenario via a runnable example, we probably could help you better.

    Anyway, hope the example above helps you find out what's wrong in your scenario.
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 2
    Last Post: Aug 10, 2015, 3:00 PM
  2. Replies: 11
    Last Post: Feb 06, 2013, 5:09 PM
  3. [CLOSED] TreePanel Node Check Through Javascript
    By Patrick_G in forum 2.x Premium Help
    Replies: 2
    Last Post: Nov 15, 2012, 3:36 PM
  4. Replies: 1
    Last Post: Apr 08, 2010, 6:28 PM
  5. Replies: 2
    Last Post: Mar 04, 2010, 4:07 PM

Posting Permissions