PDA

View Full Version : Tree dataUrl working but same method isn't working trough Direct



ImShogun
24 Sep 2009, 4:56 AM
Hello,

I'm trying to use an Ext.Tree.TreeLoader to get the nodes for my tree, but it ain't working (I click, the loading icon show, then that's all.)

My code:



//CANVAS GENERAL
viewport = new Ext.Viewport({
xtype:'container',
layout:'border',
toolbar:Toolbar,
items:[
{
xtype:'treepanel',
//dataUrl:'extcfm/extjsmaker.cfc?method=getTreeNodes',
collapsible:true,
region:'west',
title:'ExtJS "dom" structure explorer',
width:250,
root: {
id: 'root',
text: 'HTML Template Body'
},
loader: new Ext.tree.TreeLoader({
directFn: Ext.ss.extjsmaker.getTreeNodes
})
},
{
title:'About this Editor',
width:150,
collapsible:true,
region:'east',
padding:'5 5 5 5',
html:'ExtJS code being structured like a tree, let\'s just use <u>this</u> ExtJS+cfc+oracle little application to generate the ExtJS code itself...'
},
{
xtype:'panel',
region:'center',
title:'parameters'
}
]
});
});
When I adress my component trough dataUrl, this is the response I get:



[{"id":1.0,"text":"A leaf node","leaf":true},{"id":2.0,"text":"Another leaf node","leaf":true}]...and it works perfectly, but when I query the very same component to my Direct implementation, nothing is happening, even if the result seems ok:



[{"method":"getTreeNodes","tid":2.0,"action":"extjsmaker","type":"rpc","result":[{"id":1.0,"text":"A leaf node","leaf":true},{"id":2.0,"text":"Another leaf node","leaf":true}]}]


I don't understand. Do you?

Thank you for your help!

Laurent

Artistan
24 Sep 2009, 7:17 AM
I am also having this problem. Any solution yet???

Artistan
24 Sep 2009, 7:25 AM
Found It!!

http://www.extjs.com/forum/showthread.php?p=337536#post337536

Ext.Direct Remoting With Tree

http://www.extjs.com/deploy/ext-3.0-rc2/examples/direct/direct-tree.php

I have been doing alot of my code with reusable config arrays rather than creating new objects.
If you paste this into firebug console and run on the URL above it will work.



try{
var p = new Ext.Panel({
title: 'TEST',
//frame:true,
items: [
{
xtype: 'panel',
layout: 'fit',
deferredRender: true,
frame:true,
items: [{
title:'Tree Test',
xtype: 'treepanel',
width: 400,
height: 400,
useArrows: true,
autoScroll: true,
animate: true,
border: false,
tools: [
{
id:'refresh',
handler: function(event,toolEl,panel,toolconfig){
console.log(event,toolEl,panel,toolconfig);
panel.getRootNode().reload();
},
qtip:'Refresh'
}
],
loader: new Ext.tree.TreeLoader({
directFn: TestAction.getTree,
listeners: {
load: function(tree,node,callback){
try{
console.log('tree load: ',tree,node,callback);
}catch(e){
console.log(e);
}
}
}
}),
root: {
id: 'root',
text: 'Files',
expanded:true
},
fbar: [{
text: 'Reload root',
handler: function(obj,evnt){
var tree = obj.findParentByType('treepanel');
tree.getRootNode().reload();
}
}]

}]
}
]
}).render(Ext.getBody());

} catch (e) {
console.log(e);
}

ImShogun
25 Sep 2009, 1:35 AM
Well, I still have the problem. I tryed your code but of course I can't use your action, so i did switch it with mine, and it is still not working.

Could you paste the response you get from your method? maybe it will help me? I could then do some further debugging.

Thanks

Artistan
30 Sep 2009, 6:32 PM
As I stated in the post with code...
Goto Direct Tree Example (http://www.extjs.com/deploy/ext-3.0-rc2/examples/direct/direct-tree.php) and open firebug. Paste the code and the console and run it. You can see the response for yourself!!
:)