PDA

View Full Version : problem using nodeConfigFn with treeloader



vaishalishah
29 Mar 2010, 2:32 AM
Hi,
My json is a customized one. therefore to bind it to a tree loader i tried using a nodeConfigFn (I came across this in the forums). However i am not getting the results text in my tree. i get to see only empty folders. Could someone help out asap..


this is .js file
Ext.onReady(function(){


var createMyNode = function(data) {
return{
text:'task'
}
}

var tree = new Ext.tree.TreePanel({
renderTo:document.body,
title: 'My Task List',
height: 300,
width: 400,
useArrows:true,
autoScroll:true,
animate:true,
enableDD:true,
containerScroll: true,
rootVisible: false,
frame: true,

root: {
nodeType: 'async',
id:'task'
} ,
loader:new Ext.tree.TreeLoader({
dataUrl: 'http://localhost:8080/MyWar6/treegrid-data.json',
nodeConfigFn : this.createMyNode
})

});



tree.getRootNode().expand(true);
});



This is my json file

[{
"task":'Project: Shopping',
"duration":13.25,
"user":'Tommy Maintz',
"iconCls":'task-folder',
"expanded": true,
"children":[{
"task":'Housewares',
"duration":1.25,
"user":'Tommy Maintz',
"iconCls":'task-folder',
"children":[]
}]
}]