Make sure widgetContainer is initialized before loading, prevents timing problems

This commit is contained in:
Nathan Gray 2013-04-01 18:35:49 +00:00
parent 3623ee6e72
commit bdb148d167

View File

@ -193,8 +193,29 @@ etemplate2.prototype.load = function(_name, _url, _data)
// Create the document fragment into which the HTML will be injected
var frag = document.createDocumentFragment();
// Asynchronously load the XET file (code below is executed ahead of the
// code in the loadXMLFromURL function)
// Clear any existing instance
this.clear();
// Create the basic widget container and attach it to the DOM
this.widgetContainer = new et2_container(null);
this.widgetContainer.setApiInstance(egw(appname, egw.elemWindow(this.DOMContainer)));
this.widgetContainer.setInstanceManager(this);
this.widgetContainer.setParentDOMNode(this.DOMContainer);
// store the id to submit it back to server
if(_data) {
this.etemplate_exec_id = _data.etemplate_exec_id;
}
// set app_header
if (window.opener) { // popup
document.title = _data.app_header;
} else {
// todo for idots or jdots framework
}
// Asynchronously load the XET file
et2_loadXMLFromURL(_url, function(_xmldoc) {
// Scan for templates and store them
@ -224,27 +245,6 @@ etemplate2.prototype.load = function(_name, _url, _data)
this.resize();
}, this);
// Clear any existing instance
this.clear();
// Create the basic widget container and attach it to the DOM
this.widgetContainer = new et2_container(null);
this.widgetContainer.setApiInstance(egw(appname, egw.elemWindow(this.DOMContainer)));
this.widgetContainer.setInstanceManager(this);
this.widgetContainer.setParentDOMNode(this.DOMContainer);
// store the id to submit it back to server
if(_data) {
this.etemplate_exec_id = _data.etemplate_exec_id;
}
// set app_header
if (window.opener) { // popup
document.title = _data.app_header;
} else {
// todo for idots or jdots framework
}
// Split the given data into array manager objects and pass those to the
// widget container
this.widgetContainer.setArrayMgrs(this._createArrayManagers(_data));