1. #1
    Sencha User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    foldhero is on a distinguished road

      0  

    Default tree.Panel - calling expandAll at end of page loading probleml

    tree.Panel - calling expandAll at end of page loading probleml


    I am using Ext4.1 Beta, when I use tree.Panel, at the end of the scripts, I call tree.expandAll() to expand all the nodes, this cause the tree to only show first few nodes in Firefox, while in IE, although all nodes are loaded, the line space are wrong and drag drop not working. If I call tree.getRootNode().expand(false), the tree was working as expected. I am not sure if somebody else has the problem too or it is only me.

    Following are the html file and the json file to demonstrate the problem.

    Html
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Edit Tree Error Sample</title>
    <link rel="stylesheet" type="text/css" href="/js/extjs/resources/css/ext-all.css"/>
    <script type="text/javascript" src="/js/extjs/ext-all-debug.js"></script>
    
    <script>
    Ext.onReady(function(){
    
        var trStore = Ext.create('Ext.data.TreeStore', {
            proxy: {
                type: 'ajax',
                url: 'edittreeerror.json'
                
            },
            root: {
                text: 'Tasks',
                id: 'root',
                editable:false
            }
        });
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing' , 
                                            {
                                                clicksToEdit: 2,
                                                listeners: {
                                                beforeedit : function(theEditor, theObj, theOptions) {
                                                                            if(theObj.rowIdx == 0) return false;
                                                                            return true;
                                                                        }
                                                }
        });
        
    
        var tree = Ext.create('Ext.tree.Panel', {
            renderTo: 'treediv',
            height: 400,
            useArrows:true,
            autoScroll:true,
            //autoHeight : true,
            animate:true,
            viewConfig: {
                plugins: {
                    ptype: 'treeviewdragdrop'
                }
            },
            containerScroll: false,
            store: trStore,
            
            columns : [{
                    dataIndex: 'text'
                    ,editor: {
                        allowBlank: false
                        ,xtype: 'textareafield'
                    }
                    ,flex: 1
                    ,text: ''
                    ,xtype: 'treecolumn'  //REQUIRED
                }],
            
            
            plugins: [
            cellEditing
            ]
        });
    
        tree.expandAll();
        //tree.getRootNode().expand(false);
    });
    </script>
    </head>
    <body>
    
    <div id="treediv" style="height:100%;width:100%;border:1px solid #c3daf9;"></div>
    </body>
    </html>
    Json
    Code:
    [{"text":"dnd t1","children":[{"text":"fd21","children":[],"id":"741"},{"text":"fd21 (742)","children":[],"id":"742"},{"text":"fd21 (743)","children":[],"id":"743"},{"text":"fd21 (742) (744)","children":[],"id":"744"},{"text":"fd21 (745)","children":[],"id":"745"},{"text":"fd21 (742) (746)","children":[],"id":"746"},{"text":"fd21 (743) (747)","children":[],"id":"747"},{"text":"fd8","children":[],"id":"748"},{"text":"fd21 (749)","children":[],"id":"749"},{"text":"fd21 (742) (750)","children":[],"id":"750"},{"text":"fd21 (743) (751)","children":[],"id":"751"},{"text":"fd21 (742) (744) (752)","children":[],"id":"752"},{"text":"fd21 (745) (753)","children":[],"id":"753"},{"text":"fd21 (742) (746) (754)","children":[],"id":"754"},{"text":"fd21 (743) (747) (755)","children":[],"id":"755"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"756"}],"id":"501"},{"text":"dnd t2","children":[{"text":"fd21","children":[],"id":"809"},{"text":"fd21 (742)","children":[],"id":"810"},{"text":"fd21 (743)","children":[],"id":"811"},{"text":"fd21 (742) (744)","children":[],"id":"812"},{"text":"fd21 (745)","children":[],"id":"813"},{"text":"fd21 (742) (746)","children":[],"id":"814"},{"text":"fd21 (743) (747)","children":[],"id":"815"},{"text":"fd21 (742) (744) (748)","children":[],"id":"816"},{"text":"fd21 (749)","children":[],"id":"817"},{"text":"fd21 (742) (750)","children":[],"id":"818"},{"text":"fd21 (743) (751)","children":[],"id":"819"},{"text":"fd21 (742) (744) (752)","children":[],"id":"820"},{"text":"fd21 (745) (753)","children":[],"id":"821"},{"text":"fd21 (742) (746) (754)","children":[],"id":"822"},{"text":"fd21 (743) (747) (755)","children":[],"id":"823"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"824"}],"id":"808"},{"text":"dnd t1 (757) (774) (825)","children":[{"text":"fd21","children":[],"id":"826"},{"text":"fd21 (742)","children":[],"id":"827"},{"text":"fd21 (743)","children":[],"id":"828"},{"text":"fd21 (742) (744)","children":[],"id":"829"},{"text":"fd21 (745)","children":[],"id":"830"},{"text":"fd21 (742) (746)","children":[],"id":"831"},{"text":"fd21 (743) (747)","children":[],"id":"832"},{"text":"fd21 (742) (744) (748)","children":[],"id":"833"},{"text":"fd21 (749)","children":[],"id":"834"},{"text":"fd21 (742) (750)","children":[],"id":"835"},{"text":"fd21 (743) (751)","children":[],"id":"836"},{"text":"fd21 (742) (744) (752)","children":[],"id":"837"},{"text":"fd21 (745) (753)","children":[],"id":"838"},{"text":"fd21 (742) (746) (754)","children":[],"id":"839"},{"text":"fd21 (743) (747) (755)","children":[],"id":"840"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"841"}],"id":"825"},{"text":"dnd t1 (791) (842)","children":[{"text":"fd21 (743) (747)","children":[],"id":"843"},{"text":"fd21 (742) (744) (748)","children":[],"id":"844"},{"text":"fd21 (749)","children":[],"id":"845"},{"text":"fd21 (742) (750)","children":[],"id":"846"},{"text":"fd21 (743) (751)","children":[],"id":"847"},{"text":"fd21 (742) (744) (752)","children":[],"id":"848"},{"text":"fd21 (745) (753)","children":[],"id":"849"},{"text":"fd21 (742) (746) (754)","children":[],"id":"850"},{"text":"fd21 (743) (747) (755)","children":[],"id":"851"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"852"},{"text":"fd21","children":[],"id":"853"},{"text":"fd21 (742)","children":[],"id":"854"},{"text":"fd21 (743)","children":[],"id":"855"},{"text":"fd21 (742) (744)","children":[],"id":"856"},{"text":"fd21 (745)","children":[],"id":"857"},{"text":"fd21 (742) (746)","children":[],"id":"858"}],"id":"842"},{"text":"dnd t1 (859)","children":[{"text":"fd21","children":[],"id":"860"},{"text":"fd21 (742)","children":[],"id":"861"},{"text":"fd21 (743)","children":[],"id":"862"},{"text":"fd21 (742) (744)","children":[],"id":"863"},{"text":"fd21 (745)","children":[],"id":"864"},{"text":"fd21 (742) (746)","children":[],"id":"865"},{"text":"fd21 (743) (747)","children":[],"id":"866"},{"text":"fd21 (742) (744) (748)","children":[],"id":"867"},{"text":"fd21 (749)","children":[],"id":"868"},{"text":"fd21 (742) (750)","children":[],"id":"869"},{"text":"fd21 (743) (751)","children":[],"id":"870"},{"text":"fd21 (742) (744) (752)","children":[],"id":"871"},{"text":"fd21 (745) (753)","children":[],"id":"872"},{"text":"fd21 (742) (746) (754)","children":[],"id":"873"},{"text":"fd21 (743) (747) (755)","children":[],"id":"874"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"875"}],"id":"859"},{"text":"dnd t1 (757)","children":[{"text":"fd21","children":[],"id":"758"},{"text":"fd21 (742)","children":[],"id":"759"},{"text":"fd21 (743)","children":[],"id":"760"},{"text":"fd21 (742) (744)","children":[],"id":"761"},{"text":"fd21 (745)","children":[],"id":"762"},{"text":"fd21 (742) (746)","children":[],"id":"763"},{"text":"fd21 (743) (747)","children":[],"id":"764"},{"text":"fd21 (742) (744) (748)","children":[],"id":"765"},{"text":"fd21 (749)","children":[],"id":"766"},{"text":"fd21 (742) (750)","children":[],"id":"767"},{"text":"fd21 (743) (751)","children":[],"id":"768"},{"text":"fd21 (742) (744) (752)","children":[],"id":"769"},{"text":"fd21 (745) (753)","children":[],"id":"770"},{"text":"fd21 (742) (746) (754)","children":[],"id":"771"},{"text":"fd21 (743) (747) (755)","children":[],"id":"772"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"773"}],"id":"757"},{"text":"dnd t7","children":[{"text":"fd21","children":[],"id":"775"},{"text":"fd21 (742)","children":[],"id":"776"},{"text":"fd21 (743)","children":[],"id":"777"},{"text":"fd21 (742) (744)","children":[],"id":"778"},{"text":"fd21 (745)","children":[],"id":"779"},{"text":"fd21 (742) (746)","children":[],"id":"780"},{"text":"fd21 (743) (747)","children":[],"id":"781"},{"text":"fd21 (742) (744) (748)","children":[],"id":"782"},{"text":"fd21 (749)","children":[],"id":"783"},{"text":"fd21 (742) (750)","children":[],"id":"784"},{"text":"fd21 (743) (751)","children":[],"id":"785"},{"text":"fd21 (742) (744) (752)","children":[],"id":"786"},{"text":"fd21 (745) (753)","children":[],"id":"787"},{"text":"fd21 (742) (746) (754)","children":[],"id":"788"},{"text":"fd21 (743) (747) (755)","children":[],"id":"789"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"790"}],"id":"774"},{"text":"dnd t8","children":[{"text":"fd21 (743) (747)","children":[],"id":"798"},{"text":"fd21 (742) (744) (748)","children":[],"id":"799"},{"text":"fd21 (749)","children":[],"id":"800"},{"text":"fd21 (742) (750)","children":[],"id":"801"},{"text":"fd21 (743) (751)","children":[],"id":"802"},{"text":"fd21 (742) (744) (752)","children":[],"id":"803"},{"text":"fd21 (745) (753)","children":[],"id":"804"},{"text":"fd21 (742) (746) (754)","children":[],"id":"805"},{"text":"fd21 (743) (747) (755)","children":[],"id":"806"},{"text":"fd21 (742) (744) (748) (756)","children":[],"id":"807"},{"text":"fd21","children":[],"id":"792"},{"text":"fd21 (742)","children":[],"id":"793"},{"text":"fd21 (743)","children":[],"id":"794"},{"text":"fd21 (742) (744)","children":[],"id":"795"},{"text":"fd21 (745)","children":[],"id":"796"},{"text":"fd21 (742) (746)","children":[],"id":"797"}],"id":"791"}]

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,404
    Vote Rating
    850
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    The issue is you are trying to expand the tree before the store is loaded. If you want all nodes expanded, why not added expanded : true in your JSON?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    foldhero is on a distinguished road

      0  

    Default


    Thank you very much for your reply! Your tip solved my problem.

Thread Participants: 1