fixed not expanded onchange attribute, if widget type need to be expanded too, eg. log-viewer in CalDAV or eSync preferences

This commit is contained in:
Ralf Becker 2014-01-27 21:59:29 +00:00
parent d6b7350e5b
commit ace95f26b0
2 changed files with 22 additions and 21 deletions

View File

@ -115,6 +115,13 @@ function et2_checkType(_val, _type, _attr, _widget)
return _val;
}
// we dont check default-value any further, that also fixes type="js" does NOT accept null,
// which happens on expanded values
if (_val === et2_typeDefaults[_type])
{
return _val;
}
// If the type is boolean, check whether the given value is exactly true or
// false. Otherwise check whether the value is the string "true" or "false".
if (_type == "boolean")

View File

@ -660,6 +660,13 @@ var et2_widget = Class.extend(
entry = null;
}
// if _nodeName / type-attribute contains something to expand (eg. type="@${row}[type]"),
// we need to expand it now as it defines the constructor and by that attributes parsed via parseXMLAttrs!
if (_nodeName.charAt(0) == '@' || _nodeName.indexOf('$') >= 0)
{
_nodeName = attributes["type"] = this.getArrayMgr('content').expandName(_nodeName);
}
// Get the constructor - if the widget is readonly, use the special "_ro"
// constructor if it is available
var constructor = typeof et2_registry[_nodeName] == "undefined" ?
@ -672,19 +679,6 @@ var et2_widget = Class.extend(
// Parse the attributes from the given XML attributes object
this.parseXMLAttrs(_node.attributes, attributes, constructor.prototype);
// check if parseXMLAttrs gives a different type attribute eg. type="@${row}[type]"
if (attributes.type && attributes.type != _nodeName)
{
// set _nodeName and constructor accordingly
_nodeName = attributes.type;
constructor = typeof et2_registry[_nodeName] == "undefined" ?
et2_placeholder : et2_registry[_nodeName];
if (readonly && typeof et2_registry[_nodeName + "_ro"] != "undefined")
{
constructor = et2_registry[_nodeName + "_ro"];
}
}
// Do an sanity check for the attributes
constructor.prototype.generateAttributeSet(attributes);