PDA

View Full Version : Another Scope Question



brookd
2 Feb 2008, 11:43 AM
FIXED: As per usual, as soon as I posted I found the answer. My syntax was wrong, this works:

listeners:{
click:{scope:this.controller, fn:this.controller.nodeClick}
}


====

I have a tree, and I am trying to attach a listener on a click event. I can get the click event to fire, but I can not get the scope setting to work. My psudeo code is:



this.projectTree = new Ext.tree.TreePanel({
title: 'Project Browser',
region: 'west',
....
scope:this.controller,
listeners: {
'click': this.controller.nodeClick,
}

})

When the nodeClick method in the controller class runs, the 'this' scope is the tree, not the controller even though the scope was set. What am I missing??