PDA

View Full Version : [Solved]ColumnTree problem: some nodes not expanding



ant885
21 Apr 2008, 6:30 AM
Hello all, I've been working with ext for a week so sorry if this is mundane. I've come across the following problem with ColumnTree. I initially load three nodes, then use async pulls to get children as necessary. Of the three nodes, the first works perfectly down to the last great great ... grandchild. However the second and third nodes don't expand at all, but the browser response shows the same data coming back as with the first (see attached).

Is there a declaration problem within the tree? Do I need to use multiple "new Ext.tree.AsyncTreeNode" entries?

I'm not sure what portion of code would help identify the problem, but I'm thinking its something to do with:


Ext.onReady(function(){
var tree = new Ext.tree.ColumnTree({
el:'tree-ct',
width:'100%',
autoHeight:true,
rootVisible:false,
autoScroll:true,
title: 'Example Tasks',

columns:[{
header:'Task',
width:400,
dataIndex:'task'
},{
header:'Task WBS',
width:100,
dataIndex:'id'
},{
header:'Percent Complete',
width:100,
dataIndex:'percent'
},{
header:'Start Date',
width:100,
dataIndex:'start',
renderer: Ext.util.Format.dateRenderer('n/j/Y')
},{
header:'End Date',
width:100,
dataIndex:'end',
renderer: Ext.util.Format.dateRenderer('n/j/Y')
},{
header:'Actual Start Date',
width:100,
dataIndex:'astart',
renderer: Ext.util.Format.dateRenderer('n/j/Y')
},{
header:'Actual End Date',
width:100,
dataIndex:'aend',
renderer: Ext.util.Format.dateRenderer('n/j/Y')
}],

loader: new Ext.tree.TreeLoader({
dataUrl:'MyDataURL',
uiProviders:{
'col': Ext.tree.ColumnNodeUI
}

}),

root: new Ext.tree.AsyncTreeNode({
text:'Tasks',
draggable:false,
id:'0'
})
});

tree.on('expandnode', function(node) {
console.log("expanded node: "+node.attributes.id);
});

tree.render();
});
The code is just one of the examples modified to post to PHP and query a MySQL db, instead of using hardcoded nodes. I can post the whole code, just wasn't sure if it was necessary.

The second image is after I expand Task 2. The expand icon disappears and nothing gets loaded.

ant885
23 Apr 2008, 3:22 AM
Found the problem, one of the task names in both the second and third node had an apostrophe. I just needed to escape the task names to fix it.