I wrote a jQuery UI widget like this:
$.widget("ns.wid", {
options: {
attr1: "something1",
attr2: {
"sub_attr": this.__renderList,
"css": {
"opacity": '0.58'
},
},
},
__renderList: function() {
console.log("I should be invoked through attr2.sub_attr!");
}
});
Now it's not working, as the this
inside attr2
does not reference to the widget instance, instead it references the Window
. How can I reference to the widget instance without directly naming it? Thanks.