forked from extern/egroupware
Moved loading of data-array attributes to the new 'loadingFinished' function
This commit is contained in:
parent
7800cfc5d4
commit
8207a325aa
@ -109,7 +109,7 @@ class etemplate_new
|
||||
'sel_options' => $sel_options,
|
||||
'readonlys' => $readonlys,
|
||||
'modifications' => $this->modifications,
|
||||
'validation_errros' => self::$validation_errors,
|
||||
'validation_errors' => self::$validation_errors,
|
||||
)).');
|
||||
</script>
|
||||
';
|
||||
|
@ -60,6 +60,21 @@ var et2_inputWidget = et2_baseWidget.extend(et2_IInput, {
|
||||
this._oldValue = "";
|
||||
},
|
||||
|
||||
loadingFinished: function() {
|
||||
this._super.call(this, arguments);
|
||||
|
||||
if (this.id != "")
|
||||
{
|
||||
// Set the value for this element
|
||||
var contentMgr = this.getArrayMgr("content");
|
||||
var val = contentMgr.getValueForID(this.id);
|
||||
if (val !== null)
|
||||
{
|
||||
this.set_value(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
set_value: function(_value) {
|
||||
this._oldValue = _value;
|
||||
|
||||
@ -73,7 +88,8 @@ var et2_inputWidget = et2_baseWidget.extend(et2_IInput, {
|
||||
set_id: function(_value) {
|
||||
this.id = _value;
|
||||
|
||||
// Set the id of the input node
|
||||
// Set the id of the _input_ node (in contrast to the default
|
||||
// implementation, which sets the base node)
|
||||
var node = this.getInputNode();
|
||||
if (node)
|
||||
{
|
||||
@ -86,17 +102,6 @@ var et2_inputWidget = et2_baseWidget.extend(et2_IInput, {
|
||||
node.removeAttribute("id");
|
||||
}
|
||||
}
|
||||
|
||||
// Set the value for this element
|
||||
var mgr = this.getArrayMgr("content");
|
||||
if (_value != '' && mgr != null)
|
||||
{
|
||||
var val = mgr.getValueForID(this.id);
|
||||
if (val !== null)
|
||||
{
|
||||
this.set_value(val);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
get_value: function() {
|
||||
|
@ -383,6 +383,9 @@ var et2_widget = Class.extend({
|
||||
var widget = new constructor(this, _nodeName)
|
||||
widget.loadFromXML(_node);
|
||||
|
||||
// Call the "loadFinished" function of the widget
|
||||
widget.loadingFinished();
|
||||
|
||||
return widget;
|
||||
},
|
||||
|
||||
@ -472,6 +475,14 @@ var et2_widget = Class.extend({
|
||||
loadContent: function(_content) {
|
||||
},
|
||||
|
||||
/**
|
||||
* Called when loading of the widget from XML node is finished. This
|
||||
* function can be used to load the data from the data arrays (content,
|
||||
* readonlys, sel_options etc.)
|
||||
*/
|
||||
loadingFinished: function() {
|
||||
},
|
||||
|
||||
/**
|
||||
* Calls the setter of each property with its current value, calls the
|
||||
* update function of all child nodes.
|
||||
|
@ -71,7 +71,7 @@ etemplate2.prototype._createArrayManagers = function(_data)
|
||||
}
|
||||
|
||||
// Create all neccessary _data entries
|
||||
var neededEntries = ["content", "readonlys", "validation_errors"];
|
||||
var neededEntries = ["content", "sel_options", "readonlys", "modifications", "validation_errors"];
|
||||
for (var i = 0; i < neededEntries.length; i++)
|
||||
{
|
||||
if (typeof _data[neededEntries[i]] == "undefined")
|
||||
|
Loading…
Reference in New Issue
Block a user