Nikolajtesla
27 Oct 2010, 3:36 PM
I have a simple TreePanel.
var menu = new Ext.tree.TreePanel({
id: menu,
autoScroll: true,
animate: true,
enableDD: false,
border: false,
containerScroll: true,
dataUrl: 'get-nodes.php',
rootVisible: false,
root: {
nodeType: 'async',
text: 'Tree Root',
draggable: false,
id: '0'
}
});
Data, which is received via get-nodes.php is structured in the following way:
[{"id":"6","text":"node_2","uri":"uri_1","leaf":false},...,{"id":"1","text":"node_1","uri":"uri_2","leaf":false}]
I need to do the following thing. On click of each node i need to redirect to the uri, this node provided.
I tried something like this. I've added listener into the tree
listeners: {
click: function(node, event){
window.location=node;
}
}
var menu = new Ext.tree.TreePanel({
id: menu,
autoScroll: true,
animate: true,
enableDD: false,
border: false,
containerScroll: true,
dataUrl: 'get-nodes.php',
rootVisible: false,
root: {
nodeType: 'async',
text: 'Tree Root',
draggable: false,
id: '0'
}
});
Data, which is received via get-nodes.php is structured in the following way:
[{"id":"6","text":"node_2","uri":"uri_1","leaf":false},...,{"id":"1","text":"node_1","uri":"uri_2","leaf":false}]
I need to do the following thing. On click of each node i need to redirect to the uri, this node provided.
I tried something like this. I've added listener into the tree
listeners: {
click: function(node, event){
window.location=node;
}
}