PDA

View Full Version : Treepanel Component but no nodes gets loaded



pehape
17 Jul 2009, 1:41 AM
hello

i try to setup an application architecture for my extjs frontend. for this i load the viewport skeleton with xtype init via backend (php) into my application.js file. In the west region i want to have a treepanel which i want to load via xtype. For now the viewport inclusive the treepanel in the west region gets rendered without any error. Only the treenodes themselves don't get rendered. If i take a look into firebug, i see that there is an html div with the right id i've setup in the component config. only the treenodes fail. the async tree node looks okay and the server response for the node request looks fine too. Is there anybody out there, who could help me out of the newbie trap?


This following code is the code for the Treepanel component



Ext.ux.myApplication.TreePanel = Ext.extend(Ext.tree.TreePanel, {
id:'nav-tree'
,region : 'west'
,split : true
,width : 280
,minSize : 175
,maxSize : 500
,collapsible : true
,margins : '0 0 5 5'
,cmargins : '0 0 0 0'
,rootVisible : false
,lines : false
,autoScroll : true
,animCollapse : false
,animate : false
,collapseMode : 'mini'
,collapseFirst : false

,initComponent : function() {

// hard coded config (cannot be changed from outside)
var config = {};

// todo: add other keys and put them to context menu
if(!this.keys) {
config.keys = (function() {
var keys = [];
if(true === this.editable) {
keys.push({
key:Ext.EventObject.DELETE
,scope:this
,stopEvent:true
,handler:this.onKeyDelete
});

keys.push({
key:Ext.EventObject.F2
,scope:this
,stopEvent:true
,handler:this.onKeyEdit
});
}
return keys;
}.call(this));
}

// apply config
Ext.apply(this, Ext.apply(this.initialConfig, config));
// }}}
// {{{
// call parent
Ext.ux.myApplication.TreePanel.superclass.initComponent.apply(this, arguments);

this.root = new Ext.tree.AsyncTreeNode({
text:'Rootnode'
,id:'root'
,expanded:true
,allowDrag:false
});

if(!this.loader) {
this.loader = new Ext.ux.myApplication.treeLoader;
};
Ext.ux.myApplication.TreePanel.superclass.initComponent.apply(this, arguments);
}

});


Ext.reg('Ext.ux.myApplication.TreePanel', Ext.ux.myApplication.TreePanel);




This following code is the code for the Treeloader component




Ext.ux.myApplication.treeLoader = Ext.extend(Ext.tree.TreeLoader, {
dataUrl:Ext.ux.myApplication.request({url:'renderTree'})
,baseParams:{requestAction: 'projectCategoryTree', type:'160',action:'renderTree',cls:'ext.cls'}
,preloadChildren: true
,clearOnLoad: false

,initComponent : function() {
Ext.apply(this, config);
this.addEvents({
"beforeload" : true,
"load" : true,
"beforerender" : true,
"loadexception" : true
});
Ext.ux.myApplication.treeLoader.superclass.initComponent.apply(this, arguments);
}


});

Ext.reg('Ext.ux.myApplication.treeLoader', Ext.ux.anApp.treeLoader);