Results 1 to 2 of 2

Thread: ExtJS TreePanel mixed style - async and static

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Location
    riga
    Posts
    3
    Vote Rating
    0
      0  

    Thumbs up ExtJS TreePanel mixed style - async and static

    I spent my first half of day trying to figure out how to create treePanel where every other level is statically loaded in higher level async load.

    It is necessary because each pair level has different meaning and to save server resources I load data in one ajax for two levels.

    Root is AsyncTreeNode.
    First level is simple TreeNode.
    Second level is again AsyncTreeNode.

    To accomplish this I override createNode function in TreeLoader:

    Code:
     this.treeLoader = new Ext.tree.TreeLoader({
                dataUrl: 'data.php',
                baseParams: {  }
                 ,createNode : function(node){
                    node.text = node.name;
                    if (typeof(node.sub)!='undefined') {
                        node.text += ' ('+ node.sub.length +')'; // sub level count
                    } else  {
                        node.leaf = true; // if no then create as leaf
                    }                
                    a =  new Ext.tree.TreeNode(node); // I create simple TreeNode manualy
                    for (var i in node.sub) { // sub is array from server where level names ar stored
                        if (i=='remove') break; // wtf! ExtJS :) 
                        a.appendChild(new Ext.tree.AsyncTreeNode({text:node.sub[i].text})); // append all children
                    }
                    return a; // return the node
                    //return Ext.tree.TreeLoader.prototype.createNode.call(this, node); // do not return in standard way
                } 
            });

  2. #2
    Sencha User
    Join Date
    Jan 2009
    Posts
    2
    Vote Rating
    0
      0  

    Default Any ideas for doing the same with ExtJs 4?

    Hi,

    I saw this sollution and it is exactly what I want, but I'm using jsExt 4.
    I could try to migrate the code, but the problem is that I don't see config properties like 'dataUrl', 'typeof', or the component 'AsyncTreeNode', which are essential to accomplish this.
    Perhaps there is no possibility to to an async tree node in ExtJs?

    Any help would be appreciated,

    Best regards,

    Leo

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
  •