I'm not quite sure how to fix this problem I'm having. I created a
custom object that contains an autocomplete widget with a datatable.
I used the example off the YUI site that had me use DS_JSFunction for
my autocomplete widget, however the oFunction that it's calling is
referenced from the global scope when I want it to be local. I all
actuality, I'm not even sure how it's calling from the global scope in
this case.
Here is my situation, in code:
var myObj = function() {
return {
vars:null,
init: function() {
//do stuff
this.myACDataSource = new YAHOO.widget.DS_JSFunction(this.someFunc);
}
someFunc: function() {
this.myvar = 'foo';
}
}
}
So, when I debug this w/Firebug with a breakpoint on the line
this.myvar = 'foo', firebug tells me:
this = window test.jsp
I'm so very confused as to how this is the case when clearly the
function called was in the scope of myObj. I've worked around it by
calling this.myObjInstance.myvar, but I feel that this is a hack and
there should be a better way to do this.
.