PDA

View Full Version : [CLOSED][3.??] TreePanel with JSON TreeLoader cannot expand children nodes



javist
11 Jun 2009, 10:36 PM
I tested the following tree, found that it didn't work in IE7 and IE8, but work well in FF3.

Could anyone give me suggestion or quick fix for it?

Thanks.




var json = [
{"text" : "Audi", "id" : 100, "leaf" : false, "cls" : "folder", "children" : [
{"text" : "A3", "id" : 1000, "leaf" : false, "cls" : "folder",expanded : true, "children" :
[ {"text" : "Fuel Economy", "id" : "100000", "leaf" : true, "cls" : "file"},
{"text" : "Invoice", "id" : "100001", "leaf" : true, "cls" : "file"},
{"text" : "MSRP", "id" : "100002", "leaf" : true, "cls" : "file"},
{"text" : "Options", "id" : "100003", "leaf" : true, "cls" : "file"},
{"text" : "Specifications", "id" : "100004", "leaf" : true, "cls" : "file"}
]
},
{"text" : "A4", "id" : 2000, "leaf" : false, "cls" : "folder", "children" :
[ {"text" : "Fuel Economy", "id" : "200000", "leaf" : true, "cls" : "file"},
{"text" : "Invoice", "id" : "200001", "leaf" : true, "cls" : "file"},
{"text" : "MSRP", "id" : "200002", "leaf" : true, "cls" : "file"},
{"text" : "Options", "id" : "200003", "leaf" : true, "cls" : "file"},
{"text" : "Specifications", "id" : "200004", "leaf" : true, "cls" : "file"}
]
},
]}
];

var tree = new Ext.tree.TreePanel( {
animate:true,
enableDD:false,
loader: new Ext.tree.TreeLoader(), // Note: no dataurl, register a TreeLoader to make use of createNode()
lines: true,
renderTo: document.body,
root: new Ext.tree.AsyncTreeNode({
text: 'Autos',
draggable:false,
id:'source',
children: json
}),
rootVisible:true
});

evant
11 Jun 2009, 10:39 PM
Since you didn't specify any error, I'm guessing it's likely this:

http://extjs.com/forum/showthread.php?t=70180&highlight=runcallback

javist
11 Jun 2009, 11:31 PM
Since you didn't specify any error, I'm guessing it's likely this:

http://extjs.com/forum/showthread.php?t=70180&highlight=runcallback

evant, thank you very much, I followed that way, and another error occurred:

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.1)
Timestamp: Fri, 12 Jun 2009 07:29:59 UTC


Message: 'undefined' is null or not an object
Line: 29011
Char: 13
Code: 0
URI: http://localhost:8080/eob/js/ext-all-debug.js



createNode : function(attr){
// apply baseAttrs, nice idea Corey!
if(this.baseAttrs){
Ext.applyIf(attr, this.baseAttrs);
}
if(this.applyLoader !== false){
attr.loader = this;
}
if(typeof attr.uiProvider == 'string'){
attr.uiProvider = this.uiProviders[attr.uiProvider] || eval(attr.uiProvider);
}
if(attr.nodeType){
return new Ext.tree.TreePanel.nodeTypes[attr.nodeType](attr);
}else{
return attr.leaf ?
new Ext.tree.TreeNode(attr) :
new Ext.tree.AsyncTreeNode(attr);
}
},

javist
11 Jun 2009, 11:55 PM
I found that this bug has already been fixed in SVN from this thread: http://extjs.com/forum/showthread.php?t=70374&highlight=FIXED+tree

but, the only thing is how can I get a SVN read only account?

Thank you.