1. #1
    Sencha User
    Join Date
    Sep 2012
    Posts
    83
    Vote Rating
    5
    mpost is on a distinguished road

      0  

    Default Tree panel expansion hosed after sort?

    Tree panel expansion hosed after sort?


    I'm using a TreeStore with a memory proxy. I'm manually creating all of the nodes and inserting them into the tree; every node is created with expanded: true except for the leaf nodes (which are created with leaf: true instead). After I finish adding nodes to the tree, I sort the store:

    Code:
    store.sort([{property: 'text', direction: 'ASC'}]);
    This results in my tree getting hosed: the first tier of nodes are displayed, but they're collapsed. However, they have the expanded arrow graphic and indeed calling node.isExpanded() for each of the nodes in the first layer returns true. If I click a node once (to expand it) I get an animated collapse. If I click a second time, I get an animated expansion. What the heck is going on here?

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    83
    Vote Rating
    5
    mpost is on a distinguished road

      0  

    Default


    Looks like this is a bug: setting

    Code:
    animate: false
    on the tree panel completely fixes this problem. But that blows.

  3. #3
    Sencha User
    Join Date
    Jun 2013
    Posts
    1
    Vote Rating
    0
    mmamane@us.ibm.com is on a distinguished road

      0  

    Default onLaunch vs. init

    onLaunch vs. init


    I ran into the same problem using 4.2.1 after inserting or removing nodes. Listeners in init are called twice, and listeners in onLaunch are called once.

    For example, toggleTreeCollapse is called twice from init:

    Code:
       ,init: function() {
           this.control({
                'teambuildertreegrid button[itemId="toggleTree"]': {
                       'click': this.toggleTreeCollapse
                 }
           });       
        }
    
    
       ,toggleTreeCollapse: function() {
               if (this.getTreeGrid().getRootNode().isExpanded()) {
                   this.getTreeGrid().collapseAll();
               } else {
                   this.getTreeGrid().expandAll();
               }
        }
    But once from onLaunch:

    Code:
       ,onLaunch: function() {
           this.control({
                'teambuildertreegrid button[itemId="toggleTree"]': {
                       'click': this.toggleTreeCollapse
                 }
           });       
        }
    
    
       ,toggleTreeCollapse: function() {
               if (this.getTreeGrid().getRootNode().isExpanded()) {
                   this.getTreeGrid().collapseAll();
               } else {
                   this.getTreeGrid().expandAll();
               }
        }

Thread Participants: 1

Tags for this Thread