Results 1 to 5 of 5

Thread: TreePanel, reload and save state

  1. #1

    Default TreePanel, reload and save state

    Hi all
    I'm trying to reload a tree panel, saving it's state and then resume the state after the reload but I'm having trouble.

    My treepanel is as follow:

    Code:
        var treePanel = new Ext.tree.TreePanel({
        	id: 'tree-panel',
        	title: 'x',
            region:'center',
            split: true,
            //minSize: 265,
            autoScroll: true,
            //height: 265,
            // tree-specific configs:
            rootVisible: false,
            animate: true,
            singleExpand: false,
            useArrows: true,
    
    		stateful: true,
            stateEvents: ['click','contextmenu','hide','show','destroy','collapsenode'],
            
            
            loader: new Ext.tree.TreeLoader({
        		dataUrl:'http://x/test.php'
        	})
        	,root: {
            	nodeType: 'async',
            	text: 'x',
            	draggable: false,
            	id: 'root_node'
       		}
       		,listeners: {
                click: function(n) {
                    Ext.Msg.alert('x', 'Click on: "' + n.attributes.name + '", id: '+n.attributes.id);
                }
        });
    and the code that should reload and restore state is as follow:

    Code:
    	var tree = window.top.Ext.getCmp("tree-panel");
    	var selectedNode = tree.getSelectionModel().getSelectedNode();
            var selectedNodePath = selectedNode.getPath();
        
            tree.body.mask('Aggiornamento', 'x-mask-loading');
    
            tree.root.reload();
    	tree.expandPath(selectedNodePath);
    
       	tree.body.unmask();
    I'm able to get the selected path just before the reload (selectedNodePath is "filled" correctly), masking is ok, the reload is fine, but I'm unable to get
    Code:
    tree.expandPath(selectedNodePath);
    working.

    Tree panel is not expanded.

    I've even tryied to expand that after 20 seconds (may be that the panel should finish loading befor expand) but nothing change.

  2. #2

    Default

    bump

  3. #3

    Default

    Please help me...

  4. #4
    Ext User
    Join Date
    May 2010
    Location
    Perth
    Posts
    2

    Default

    I have seen this done in v2.x.x - But that plugin no longer works. Anyone know how to get something similar going in 3.x.x?
    --Ozaki

  5. #5

    Default

    Code:
    tree.root.reload(function() {
        tree.expandPath(selectedNodePath);
    });
    Doesn't work?

Posting Permissions

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