PDA

View Full Version : TreeLoader example not working for ext-3.0-rc1.1



Datagenn
5 May 2009, 11:37 PM
Hi there,

I am unable to get the TreeLoader example working in ext-3.0-rc1.1
Firebug shows the data url is being called and the JSON data being returned but the child nodes are not being displayed in the tree.

Here is a stripped down version of the code I'm using:



<html>
<head>
<title>Work..</title>
<link rel="stylesheet" type="text/css" href="ext/resources/css/ext-all.css"/>
<script type="text/javascript" src="ext/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="ext/ext-all.js"></script>
<script type="text/javascript" src="ext/examples/data.js"></script>

<style type="text/css">
html, body {
font: normal 12px verdana;
margin: 0;
padding: 0;
border: 0 none;
overflow: hidden;
height: 100%;
}
</style>

<script type="text/javascript">
Ext.onReady(function(){

var Tree = Ext.tree;

var tree = new Tree.TreePanel('my-tree', {
animate:true,
loader: new Tree.TreeLoader({
dataUrl:'/work/get-nodes.php'
}),
enableDD:true,
containerScroll: true
//renderTo: document.body
});

// set the root node
var root = new Tree.AsyncTreeNode({
text: 'Ext JS',
draggable:false,
id:'source'
});
tree.setRootNode(root);

// render the tree
tree.render();
root.expand();

});
</script>
</head>

<body>
<div id="my-tree"></div>
</body>
</html>


'get-nodes.php' is from the examples and not modified in any way so this should be returning the correct format.

Any ideas on this?

Many thanks,
Sean

Datagenn
5 May 2009, 11:40 PM
This gives the same result:



...
items: [
{
xtype: 'treepanel',
id: 'my-tree',
region: 'center',
margins: '2 2 0 2',
autoScroll: true,
rootVisible: false,
root: new Ext.tree.AsyncTreeNode(),

// Our custom TreeLoader:
loader: new Ext.tree.TreeLoader({
dataUrl:'http://127.0.0.1/work/get-nodes.php'
})
}]
...

Datagenn
5 May 2009, 11:47 PM
Also same result with this code:



...
items: [
new Ext.tree.TreePanel({
title:'me',
el:'my-tree',
rootVisible: true,
animate: false,
autoScroll: true,
loader: new Ext.tree.TreeLoader({dataUrl:'http://127.0.0.1/work/get-nodes.php'}),
enableDD: false,
containerScroll: true,
dropConfig: {appendOnly: true},
lines: true
})
,{
title:'Settings',
html:'<p>Some settings in here.</p>',
border:false,
iconCls:'settings'
}]
...

Datagenn
7 May 2009, 2:12 AM
I found the solution:

Comment out this dang thing:


Ext.state.Manager.setProvider(new Ext.state.CookieProvider());


Sean