diff --git a/api/js/etemplate/et2_widget_link.ts b/api/js/etemplate/et2_widget_link.ts index 4ced57ac78..387d094253 100644 --- a/api/js/etemplate/et2_widget_link.ts +++ b/api/js/etemplate/et2_widget_link.ts @@ -1673,7 +1673,10 @@ export class et2_link_string extends expose(class et2_link_string extends et2_va { _value.only_app = this.options.only_app; } - this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value], this.set_value, this); + this.egw().jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_list', [_value]).then(_value => + { + this.set_value(_value); + }); return; } diff --git a/api/js/jsapi/egw_jsonq.js b/api/js/jsapi/egw_jsonq.js index 6b80284f60..fc8ba54569 100644 --- a/api/js/jsapi/egw_jsonq.js +++ b/api/js/jsapi/egw_jsonq.js @@ -148,15 +148,16 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() // as objects and loosing parameters which are undefined // JSON.stringify([123,undefined]) --> '{"0":123}' instead of '[123,null]' parameters: _parameters ? [].concat(_parameters) : [], - callbeforesend: _sender ? _callbeforesend.bind(_sender) : _callbeforesend, + callbeforesend: _callbeforesend && _sender ? _callbeforesend.bind(_sender) : _callbeforesend, }; let promise = new Promise(resolve => { jsonq_queue[uid].resolve = resolve; }); if (typeof _callback === 'function') { + const callback = _callback.bind(_sender); promise = promise.then(_data => { - _callback.bind(_sender)(_data); + callback(_data); return _data; }); }