PDA

View Full Version : How to reload and redraw TreePanel ?



sysmaker
4 Feb 2008, 2:26 AM
I have created to panel. On first place grid.
On second place tree. After select on grid line i want load tree with additional param.
Tree loaded but not draw.



var vgrid,otree,oroot,cversion;
....
function getSelectedVersion(){return cversion;}
function selectVersionAction(e,ri,rec){
cversion=rec.get('VERSION');
oloader.load(oroot);
}
....
init:....
vgrid = new gf.Grid('ver-grid',{
ds:vds,cm:vcm,autoExpandColumn:'start_finish',monitorWindowResize:true,
selModel:new Ext.grid.RowSelectionModel({singleSelect:true})
});
vgrid.render();
vgrid.getSelectionModel().on('rowselect',selectVersionAction);
oloader = new tf.TreeLoader({
clearOnLoad:true,requestMethod:'GET',
dataUrl:'userdirectory.php',baseParams:{data:'getorgs',version:0}
});
oloader.on("beforeload",function(treeLoader,node){treeLoader.baseParams.version=getSelectedVersion();},this);
otree = new tf.TreePanel('org-tree',{
lines:false,animate:true,enableDD:false,rootVisible:false,
singleExpand:true,containerScroll:true,loader:oloader
});
oroot = new tf.TreeNode({text:'Root',draggable:false,id:'0'});
otree.setRootNode(oroot);
otree.render();

After first select tree is draw and visible.
After next select TreePanel is blank.
Why ? Data for all nodes load valid.
If I add
otree.render();
after
oloader.load(oroot); in selectVersionAction function
In FF is Ok, but in IE6 look a bug
First line is empty.
If I set in TreePanel set rootVisible:true all valid in all cases.
If rootVisible:false each call selectVersionAction
add empty line on top tree panel