PDA

View Full Version : Loading TreePanel from PHP



enixser
16 Feb 2011, 11:35 PM
Hello,

I'm new to Ext JS and I make my first experiments with a TreePanel. I looked at the tutorials for getting help, especially this one:

http://www.sencha.com/learn/Tutorial:Ext20_Tree_TreeLoader_PHP_MySQL

I got the tree loading up and running now. It is loaded by my PHP classs. But one thing is annoying me: Above the TreePanel the JSON data is printed, something like:


[{"text":"2009","id":"2009","iconCls":"folder","leaf":false,"draggable":false,"href":"","hrefTarget":""},{"text":"2007","id":"2007","iconCls":"folder","leaf":false,"draggable":false,"href":"","hrefTarget":""}]

How can I suppress this output? The last line of my PHP code is this:


echo json_encode($this->nodes);

Any hints? Is the a configuration option that I missed?

Best regards,
Ralf.

enixser
21 Feb 2011, 10:28 PM
Does really noone has an idea, how to suppress this output of the tree data? Is there any debug output enabled by default?

Best regards,
Ralf.

drian
22 Feb 2011, 4:18 AM
You should check from where you get that output. Are you sure you aren't calling the php file before loading the trtee or smth like that? check with firebug and see in what dom element that output is set. I doubt it's inside an ext dom created element.

Here's my code, it works ok.


var tree = new Ext.tree.TreePanel({
useArrows: true,
autoScroll: true,
animate: true,
containerScroll: true,
border: false,
dataUrl: '/urlGoesHere',
root: {
nodeType: 'async',
text: 'Root Node'
},
rootVisible: false
});

enixser
22 Feb 2011, 4:29 AM
You are right. There was a call to the PHP file before building the tree. After removing this everything works fine.

Thanks,
Ralf.