的$ .proxy命令我有一點,有一個位外國語法來我的代碼:使用的JavaScript/jQuery的
$.widget('ui.filterFieldDisplay', $.ui.fieldDisplay, {
setFoo: function() {
.
.
.
// added the next two lines
var fooFieldWidgetOptions = fooFieldOptions.widgetOptions;
fooFieldWidgetOptions['default'] = operator;
var fooChangeProxy = $.proxy(this.fooChange, this);
fooFieldWidgetOptions.changeCallback = fooChangeProxy;
}
fooChange: function(fooModel) {
fooModel.getValue('bar');
.
.
.
}
});
在這種情況下引用到this
指針fooModel
?
我知道$.proxy
方法將this
指針綁定到函數,以便它在該上下文中操作。但我知道this
沒有被引用到fooModel
。所以我的問題是:什麼是fooModel
,它從哪裏來?
裏面我承擔'。'是你說的那種代碼,你忽略了嗎? –
是的,'''爲了保密而省略了代碼。 –