3

I have the following code snippet:

$.widget("tj.commonCoordinator", {
    options: {
        "obx_type": "common_obx",
        "obx_callbacks": {
            request_modify: function(event, ui) {
                this._loadentries();
            },
        }
    },

    _loadentries: function(){}
});

Note that inside the options object, there is a request_modify anonymous function. Inside that function I'm using this to reference the currently initiated widget instance, but failed. In this broken code the this references to the window as it is just an anonymous function.

What is the best way to make this inside a options object of the Widget factory prototype reference correctly to the widget instance? Thanks.

Jinghui Niu
  • 990
  • 11
  • 28

1 Answers1

0

Maybe you can use the proxy() method to do this:

$.proxy(this._loadentries, this)