View Full Version : How to add a childnode click event to my XML tree loader?

21 Sep 2010, 12:55 PM
I have an XML tree loader working fine and I have also defined a click event but it seems to only be working on the very rootnode, which activates fine. I am trying however to get it to work on a child node instead such as the very bottom node if possible. Below is my code and I appreciate any suggestions on how to add the click event to the child node instead of root, thanks.

function createTree(response, options) {
var doc = response.responseXML;
var root = doc.documentElement || doc;
var treePanel1 = new Ext.tree.TreePanel({
renderTo: 'tree',
loader: new Ext.ux.XmlTreeLoader({
preloadChildren: true
root: new Ext.tree.AsyncTreeNode({
text: 'Neighbourhood Search',
xmlNode: root,
listeners: {
click: function (childnode, event) {
alert('you clicked');
Ext.onReady(function () {
url: 'hoods.xml',
success: createTree