PDA

View Full Version : load tree data without url



wp.joju
11 Feb 2010, 2:11 AM
is there a way to load data to a tree using store data or any json data... anything which does not involve url... since i'm trying to use this in a windows app

Eugen_
11 Feb 2010, 2:36 AM
hi wp.joju,

You can use appendChild (http://www.extjs.com/deploy/dev/docs/source/Tree.html#method-Ext.data.Node-appendChild) Ext.tree.TreeNode method to build your tree from store or you can save data from your windows application to file and get it in store something like this "file:///..."

wp.joju
11 Feb 2010, 3:02 AM
thanks for the reply but i tried to use the appendChild method of the root node then pass json data from server side but it is not working... nothing is getting added to the node

wp.joju
11 Feb 2010, 3:51 AM
i've also tried using the dataUrl accessing a text file but cannot seem to get any data




var path = document.location.toString();
path = path.substr(0,path.lastIndexOf("/")+1) + 'sample.txt';
var tree1 = new Ext.tree.TreePanel({
dataUrl:path,
id:'directorytree',
requestMethod: 'GET',
loader: new Ext.tree.TreeLoader(),
border:false,
rootVisible:true,
root: {
nodeType:'async',
text: 'root',
draggable: false,
id: 'root',
expanded:true
}
});

Eugen_
11 Feb 2010, 9:11 AM
Creating Ext.tree.TreePanel from static JSON data in one shot (http://www.extjs.com/forum/showthread.php?t=4595)

Static Tree (http://www.mixolution.com/extjs/examples/staticTree.html)