Results 1 to 2 of 2

Thread: Changing data of TreePanel dynamically

  1. #1

    Default Changing data of TreePanel dynamically

    Hello!

    How can I change the root of my TreeStore at runtime?
    I'm getting a new data object at runtime and would like to remove the current root from my TreeStore and add the new data to it.

    I tried this:

    Code:
    treePanel.getStore().setRoot(data);
    treePanel.view.refresh();

    But the TreePanel remains empty.
    The data object is fine, because when i do this, it works:

    Code:
    var newTreeStore = Ext.create('SomeApp.store.ConfigurationTreeStore');
    newTreeStore.setRoot(data);
    newTreeStore.setStore(treeStore);


  2. #2
    Sencha User
    Join Date
    Feb 2013
    Location
    California
    Posts
    11,985
    Answers
    506

    Default

    There's an example on this thread that seems to work:
    https://www.sencha.com/forum/showthread.php?300293

Similar Threads

  1. Replies: 1
    Last Post: 28 Feb 2014, 7:10 AM
  2. Changing data in a non - rendered TreePanel
    By daddieke in forum Ext GWT: Discussion
    Replies: 3
    Last Post: 12 Jun 2010, 7:31 AM
  3. TreePanel doesn't load data dynamically
    By sheddy in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 12 Aug 2008, 3:35 AM
  4. Dynamically Changing url of Data Store
    By fangzhouxing in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 17 Jul 2008, 10:49 PM
  5. Changing Grid Column and Data Models dynamically??
    By patukk in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 31 Oct 2006, 3:15 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •