PDA

View Full Version : TreeView-child data not visible



issc
1 Feb 2010, 1:49 AM
Hi,

I have a problem with a very simple TreeView.

Saved data
-----Private
----------Data1
----------Data2
-----Public
----------Data3
----------Data4

The parent nodes are static. The child nodes (Data nodes) are dynamically loaded using a function inside a listener. For some reason data is loaded and added to the parent nodes but not visible on the screen.

Here is the code to generate the tree:

var treeSavedQueries = new Ext.tree.TreePanel({
useArrows: true,
id: 'treeSavedQueries',
autoScroll: true,
animate: true,
enableDD: true,
loader: new Ext.tree.TreeLoader({}), //no dataurl on purpose
containerScroll: true,
border: false,
listeners: { 'render': function() {
Ext.Ajax.request({
url: '/Services/QueryService.asmx/GetSavedQueries',
method: 'post',
jsonData: {},
headers: { 'Content-Type': 'application/json; charset=utf-8;' },
scope: this,
success: function(response, opts) {
var json = Ext.util.JSON.decode(response.responseText);
for (var i = 0, len = json.d.data.length; i < len; i++) {
if (json.d.data[i].shared = true)
this.root.childNodes[0].appendChild(json.d.data[i].str);
else
this.root.childNodes[1].appendChild(json.d.data[i].str);
}
}
});
}
},
root: {
iconCls: 'iconSave',
nodeType: 'async',
text: 'Saved Qeries',
draggable: false,
id: 'savedQueries',
expanded: true,
children: [{ text: 'Private', leaf: false, expanded: true },
{ text: 'Shared', leaf: false, expanded: true}]

}
});

Thanks for your help.