Hi all,
i've a general Problem with JavaScript Scopes.
In our Application we us a JavaScript Object. This is a simple Version of this Object:
So what we do is passing a RadTreeView Object to our Object Constuctor/init Function.
Then we want that our srcTree_nodeChecked Function is called when a Node is checked in the tree. Until here this works fine.
But
Our srcTree_nodeChecked function runs in another Scope. The function cant access the 'otherFunction' via 'this.otherFunction()';
This results in the ErrorMessage 'this.otherFunction is undefined.
Does someone know, how i can solve this probblem?
Thank you
regards
Alex
i've a general Problem with JavaScript Scopes.
In our Application we us a JavaScript Object. This is a simple Version of this Object:
| function FilterTree(srcTree) { |
| this.init(srcTree); |
| } |
| FilterTree.prototype = { |
| _srcTree: null, |
| _dstTree: null, |
| init: function(srcTree){ |
| this._srcTree = srcTree; |
| this._srcTree.add_nodeChecked(this.otherFunction); |
| }, |
| srcTree_nodeChecked: function(){ |
| alert('srcTree_nodeChecked: called'); |
| this.otherFunction(); |
| }, |
| otherFunction(){ |
| alert('otherFunction called'); |
| } |
| } |
So what we do is passing a RadTreeView Object to our Object Constuctor/init Function.
Then we want that our srcTree_nodeChecked Function is called when a Node is checked in the tree. Until here this works fine.
But
Our srcTree_nodeChecked function runs in another Scope. The function cant access the 'otherFunction' via 'this.otherFunction()';
This results in the ErrorMessage 'this.otherFunction is undefined.
Does someone know, how i can solve this probblem?
Thank you
regards
Alex
