Add etemplate into indexed list before starting the load process. This way anything looking for it can find it, even if it's not fully loaded (and bind to the load event if needed)

This commit is contained in:
Nathan Gray 2013-12-12 23:37:12 +00:00
parent 680ce48fef
commit 23fd7066bf

View File

@ -256,6 +256,14 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
var _load = function() {
egw.debug("log", "Loading template...");
// Add into indexed list - do this before, so anything looking can find it,
// even if it's not loaded
if(typeof etemplate2._byTemplate[_name] == "undefined")
{
etemplate2._byTemplate[_name] = [];
}
etemplate2._byTemplate[_name].push(this);
// Read the XML structure of the requested template
this.widgetContainer.loadFromXML(this.templates[_name || missing_name]);
@ -268,13 +276,6 @@ etemplate2.prototype.load = function(_name, _url, _data, _callback)
// Insert the document fragment to the DOM Container
this.DOMContainer.appendChild(frag);
// Add into indexed list
if(typeof etemplate2._byTemplate[_name] == "undefined")
{
etemplate2._byTemplate[_name] = [];
}
etemplate2._byTemplate[_name].push(this);
if(console.groupEnd)
{
egw.window.console.groupEnd();