-
28 Apr 2009 8:22 AM #1
Help, problem with TreePanel..
Help, problem with TreePanel..
Hi, I have the following code ...
...my goal is to upload the data treePanel with JSON data type, but does not issue an error to put the TreeLoader () blank, someone can help me?Code:Ext.onReady(function(){ var datosJSON = [ {"text":"A","id":10,"leaf":false,"children":[ {"text":"B","id":11,"leaf":false}, {"text":"C","id":18,"leaf":false,"children":[ {"text":"D","id":19,"leaf":false,"children":[ {"text":"E","id":191,"leaf":true}, {"text":"F","id":191,"leaf":true} ]}, {"text":"G","id":20,"leaf":false}, {"text":"H","id":21,"leaf":false} ]} ]} ]; var Tree = Ext.tree; var tree = new Tree.TreePanel('tree', { animate:true, enableDD:false, loader: new Tree.TreeLoader(),// no need a url, but here is the problem lines: true, selModel: new Ext.tree.MultiSelectionModel(), containerScroll: false }); root = new Ext.tree.AsyncTreeNode({ text: 'Autos', id:'source', children: datosJSON }); tree.setRootNode(root); root.expand(); }
-
28 Apr 2009 8:33 AM #2
-
28 Apr 2009 11:55 AM #3
Please
Please
Sorry, but you could tell me if what I'm doing this right or not, or could give me a track to find the help because I can not find any solution...

-
28 Apr 2009 12:30 PM #4
API document. Read it. Compare to your code.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
29 Apr 2009 12:57 PM #5
Success
Success
I succeed, I do not know if will be the best way but it works for me...
thks for allCode:Ext.onReady(function(){ var datosJSON = [ {"text":"A","id":10,"leaf":false,"children":[ {"text":"B","id":11,"leaf":false}, {"text":"C","id":12,"leaf":false}, {"text":"D","id":18,"leaf":false,"children":[ {"text":"E","id":19,"leaf":false,"children":[ {"text":"F","id":191,"leaf":true}, {"text":"G","id":191,"leaf":true} ]}, {"text":"H","id":20,"leaf":false} ]} ]} ]; var root = new Ext.tree.TreeNode({ expanded:true, text:'', draggable:false, id:'source', cls:"folder", children:datosJSON }); new Ext.tree.TreeLoader({preloadChildren: true}).doPreload(root); var Tree = Ext.tree; var tree = new Tree.TreePanel({ id:'tree_id', useArrows:true, animate:true, enableDD:true, autoScroll:true, border:false, rootVisible:false, root:root }); });


Reply With Quote