PDA

View Full Version : Ext.tree.ColumnTree not showing json data



murphbra
22 Dec 2010, 9:03 AM
Hi,

Please see below the code I have for loading a columntree with a json response from an ajax call.
The problem is that the data in the results of the ajax call are not being populated into the tree.
I guess I need more code to inject the json data into the tree, I currently am only ensuring that the column dataindex names, and the key names of the data in the json objects correspond. The json result object is also below,

suggestions appreciated,

brian.



[{"text":"Manager:Mario Graf","name":"Mario Graf","empId":"064R5","leaf":true,"iconCls":"cs-group-leaf","draggable":false}]


securityHierarchyTree = new Ext.tree.ColumnTree({
useArrows: true,
autoScroll: true,
animate: true,
title: 'Security Hierarchy',
containerScroll: true,
enableDD: false,
autoWidth: true,
height:300,
columns: [{
header:"Name",
width: 300,
dataIndex:'name'
},
{
header:"Role",
width: 300,
dataIndex:'role'
}],
loader: ( {
dataUrl: 'securityHierarchy.do?method=getSecurityHierarchy',
clearOnLoad: true,
// method : 'post',
preloadChildren :true,
nodeParameter:'employeeId',
uiProviders:{
'col': Ext.ux.tree.ColumnNodeUI
}
}),
root: new Ext.tree.AsyncTreeNode({
text: '',
id:'source',
draggable: false
}),
rootContext: new Ext.menu.Menu({
items: [{
id: 'addRootManager',
text: 'Add Manager',
scope: this,
handler: function(node, event) {
var contextNode = node.parentMenu.contextNode;
this.securityHierarchyFunctions.addManager(contextNode.attributes.empId);
}
}]
})
});