PDA

View Full Version : Tree data is not loading



ramaraorouthu
29 Sep 2009, 1:24 AM
Hi,

I am ExtJS beginner. I could not able to load the data and my code is:

<script language="javascript" type="text/javascript">
Ext.onReady(function(){
var treeLoader = new Ext.tree.TreeLoader({
preloadChildren: false,
clearOnLoad: false
});

var rootNode = new Ext.tree.AsyncTreeNode({
text: 'Root',
id:'root',
expanded:true,
children:[classData]
});

var tree = new Ext.tree.TreePanel({
renderTo:'treecontainer',
loader: treeLoader,
root: rootNode
});
})
</script>
<script language="javascript" type="text/javascript">
classData = [
{ id: '1', text: 'No Children', leaf: true },
{ id: '2', text: 'Has Children',
children: [{
id: '3',
text: 'Youngster',
leaf: true
}]
}
]
</script>

Please let me know your inputs.

Thanks,
RamaRao R.

29 Sep 2009, 11:42 AM
children:[classData] should be children:classData

Please use CODE tags in the future

ramaraorouthu
29 Sep 2009, 7:29 PM
Thanks for quick reply. I used 'children:classData' as you suggested. Still the data is not loading. Please help me

30 Sep 2009, 1:55 AM
var classData = [{
id: '1',
text: 'No Children',
leaf: true
},
{
id: '2',
text: 'Has Children',
children: [{
id: '3',
text: 'Youngster',
leaf: true
}]
}]

Ext.onReady(function () {
var treeLoader = new Ext.tree.TreeLoader({
preloadChildren: false,
clearOnLoad: false
});

var rootNode = new Ext.tree.AsyncTreeNode({
text: 'Root',
id: 'root',
expanded: true,
children: classData
});

var tree = new Ext.tree.TreePanel({
renderTo: 'treecontainer',
loader: treeLoader,
root: rootNode
});
});

30 Sep 2009, 1:56 AM
The above works for me

ramaraorouthu
30 Sep 2009, 2:46 AM
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title> Tree</title>

<link rel="stylesheet" type="text/css" href="ExtJS/resources/css/ext-all.css" />
<script src="ExtJS/adapter/ext/ext-base.js"></script>
<script src="ExtJS/ext-all-debug.js"></script>

<script language="javascript" type="text/javascript">
var classData = [{
id: '1',
text: 'No Children',
leaf: true
},
{
id: '2',
text: 'Has Children',
children: [{
id: '3',
text: 'Youngster',
leaf: true
}]
}]

Ext.onReady(function () {
var treeLoader = new Ext.tree.TreeLoader({
preloadChildren: false,
clearOnLoad: false
});

var rootNode = new Ext.tree.AsyncTreeNode({
text: 'Root',
id: 'root',
expanded: true,
children: classData
});

var tree = new Ext.tree.TreePanel({
renderTo: 'treecontainer',
loader: treeLoader,
root: rootNode
});
});
</script>

</head>
<body>
<div id="treecontainer" style="height:400px; width:250px; border:1px solid red; margin:5px; padding:5px"></div>
</body>
</html>


I have used your code and got error in ext-all-debug.js (Message: Object expected, Line: 28990,Char: 13). I am herewith my complete code for your considaration.

Please let know your inputs.

Thank you very much:)

30 Sep 2009, 2:48 AM
What browser are you having problems with?? I have no issues at all.

ramaraorouthu
30 Sep 2009, 2:50 AM
IE8.0

30 Sep 2009, 2:53 AM
Try FireFox, does it work for you there?

ramaraorouthu
30 Sep 2009, 3:03 AM
awesome and thanks for finding. Its working in FF, Safari amd crome.

But not working in IE6, IE7 and IE8.

ExtJS.com samples are working fine in in IE6, IE7 and IE8.

ramaraorouthu
30 Sep 2009, 3:05 AM
I am working on this tree for complete IE based application. Please let me know what is the best way to work

aconran
1 Oct 2009, 8:13 AM
IE 6+ is in our supported browser list:


Browser Compatibility

Ext JS supports all major web browsers including:

* Internet Explorer 6+
* FireFox 1.5+ (PC, Mac)
* Safari 3+
* Opera 9+ (PC, Mac)


I tried your sample in IE6 and it is working fine as shown in the attached screenshot.

ramaraorouthu
23 Oct 2009, 2:43 AM
not working for me. Is there any setting needed in IE

23 Oct 2009, 5:14 AM
What debugging have you performed?

ramaraorouthu
28 Oct 2009, 12:35 AM
I am writing code in Dreamweaver and running in IE and getting attached error. Please let know your inputs.

Thanks,
RamaRao R.

28 Oct 2009, 4:36 AM
that doesn't help. how about trying to debug with microsoft script debugger?

eriknijs
17 Nov 2009, 2:29 AM
I tried the code with version 3.0. At first it did not work in IE6.
After downgrading the ext-base.js and ext-all-debug.js files to 2.3 it worked.

Is the static tree loading feature broken in 3.0?

Thanks,
Erik

eriknijs
17 Nov 2009, 2:35 AM
solved.

seems like version 3.0.3 fixes this issue

ramaraorouthu
17 Nov 2009, 4:11 AM
Yes. Thanks

bobbertrailer
17 Nov 2009, 4:24 AM
yep 3.0.3 help.

Thanks for useful info in this topic.