PDA

View Full Version : Change SET root Node



Puzo
22 May 2009, 1:40 AM
Hello,

I have problems with Setting new ROOT node in Tree menu. How can I remove this Root Node, so the tree will start with other root node (datas from MySQL) ?

Here is code:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ExtJsLayout</title>
<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" />
<script type="text/javascript" src="../../adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../../ext-all-debug.js"></script>
<script type="text/javascript">
Ext.onReady(function() {
// Define Tree.
var Tree_Category_Loader = new Ext.tree.TreeLoader({
dataUrl :"_class4.php"
});
var Tree_Category = new Ext.tree.TreePanel({
title : 'My Category Tree',
collapsible : false,
animCollapse : false,
border : true,
id : "tree_projectcategory",
el : "tree_projectcategory",
autoScroll : true,
animate : false,
enableDD : true,
containerScroll : true,
height : 100,
width : 300,
loader : Tree_Category_Loader
});

// SET the root node.
var Tree_Category_Root = new Ext.tree.AsyncTreeNode({
text : 'My Root Node',
draggable : false,
id : '0' // this IS the id of the startnode
});

// Render the tree.
Tree_Category.setRootNode(Tree_Category_Root);
Tree_Category.render();
Tree_Category_Root.expand();
});
</script>
</head>
<body>
<div id="tree_projectcategory" ></div>
</body>
</html>

exo
23 May 2009, 4:41 AM
Set rootVisible: false on the treepanel?

Puzo
23 May 2009, 5:31 AM
Thanks for the advice, now its working!