diff --git a/phpgwapi/js/jsapi/egw_json.js b/phpgwapi/js/jsapi/egw_json.js index 2ba940aa31..a02f4fc099 100644 --- a/phpgwapi/js/jsapi/egw_json.js +++ b/phpgwapi/js/jsapi/egw_json.js @@ -95,6 +95,22 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) { json_request.prototype.handleResponse = function(data) { if (data && data.response) { + // Load files first + var js_files = []; + for (var i = data.response.length - 1; i > 0; --i) + { + var res = data.response[i]; + if(res.type == 'js' && typeof res.data == 'string') + { + js_files.unshift(res.data); + data.response.splice(i,1); + } + } + if(js_files.length > 0) + { + this.egw.includeJS(js_files, function() {this.handleResponse(data);}, this); + return; + } for (var i = 0; i < data.response.length; i++) { // Get the response object