Fixed problem with requesting already loaded JS and CSS files, fixed problem with icon height not being updated for table rows in IE

This commit is contained in:
Andreas Stöckel 2011-05-22 18:42:23 +00:00
parent 4f3dc53cb6
commit fbb5551dca
2 changed files with 25 additions and 5 deletions

View File

@ -1681,8 +1681,6 @@ function egwGridViewRow_doUpdateData(_immediate)
icon.css("height", this.item.iconSize + "px"); icon.css("height", this.item.iconSize + "px");
icon.css("width", this.item.iconSize + "px"); //has to be done because of IE :-( icon.css("width", this.item.iconSize + "px"); //has to be done because of IE :-(
} }
icon.attr("src", data[col.id].iconUrl);
icon.load({"item": this, "cntr": iconContainer}, function(e) { icon.load({"item": this, "cntr": iconContainer}, function(e) {
e.data.cntr.css("min-height", ""); e.data.cntr.css("min-height", "");
var icon = $(this); var icon = $(this);
@ -1692,6 +1690,9 @@ function egwGridViewRow_doUpdateData(_immediate)
}, 100); }, 100);
e.data.item.callHeightChangeProc(); e.data.item.callHeightChangeProc();
}); });
icon.attr("src", data[col.id].iconUrl);
overlayCntr.append(icon); overlayCntr.append(icon);
if (this.item.iconOverlay.length > 0) if (this.item.iconOverlay.length > 0)

View File

@ -121,6 +121,24 @@ function egw_json_encode(input)
*/ */
var egw_json_files = {}; var egw_json_files = {};
/**
* Initialize the egw_json_files object with all files which are already bound in
*/
$(document).ready(function() {
$("script, link").each(function() {
var file = false;
if ($(this).attr("src")) {
file = $(this).attr("src");
} else if ($(this).attr("href")) {
file = $(this).attr("href");
}
if (file) {
egw_json_files[file] = true;
}
});
});
/** /**
* Variable which stores all currently registered plugins * Variable which stores all currently registered plugins
*/ */
@ -451,7 +469,7 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
this.loadedJSFiles[res.data] = false; this.loadedJSFiles[res.data] = false;
if (typeof console != 'undefined' && typeof console.log != 'undefined') if (typeof console != 'undefined' && typeof console.log != 'undefined')
console.log("Requested JS file '%s' from server", [res.data]); console.log("Requested JS file '%s' from server", res.data);
var self = this; var self = this;
@ -459,7 +477,7 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
scriptnode.onload = function(e) { scriptnode.onload = function(e) {
var file = e.target._originalSrc; var file = e.target._originalSrc;
if (typeof console != 'undefined' && typeof console.log != 'undefined') if (typeof console != 'undefined' && typeof console.log != 'undefined')
console.log("Retrieved JS file '%s' from server", [file]); console.log("Retrieved JS file '%s' from server", file);
self.loadedJSFiles[file] = true; self.loadedJSFiles[file] = true;
self.checkLoadFinish(); self.checkLoadFinish();
@ -529,8 +547,9 @@ egw_json_request.prototype.handleResponse = function(data, textStatus, XMLHttpRe
egw_json_request.prototype.checkLoadFinish = function() egw_json_request.prototype.checkLoadFinish = function()
{ {
var complete = true; var complete = true;
for (var key in this.loadedJSFiles) for (var key in this.loadedJSFiles) {
complete = complete && this.loadedJSFiles[key]; complete = complete && this.loadedJSFiles[key];
}
if (complete && this.onLoadFinish && this.handleResponseDone) if (complete && this.onLoadFinish && this.handleResponseDone)
{ {