mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
implemented onfocus event for input-widgets, tested with textbox and taglist, others more complex input-widgets probably need to proxy the event
This commit is contained in:
parent
473da1949d
commit
3c0743cb97
@ -39,6 +39,11 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
"type": "string",
|
||||
"description": "JS code which is executed when the value changes."
|
||||
},
|
||||
"onfocus": {
|
||||
"name": "onfocus",
|
||||
"type": "string",
|
||||
"description": "JS code which get executed when wiget receives focus."
|
||||
},
|
||||
"validation_error": {
|
||||
"name": "Validation Error",
|
||||
"type": "string",
|
||||
@ -70,6 +75,7 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
if (node)
|
||||
{
|
||||
$j(node).unbind("change.et2_inputWidget");
|
||||
$j(node).unbind("focus");
|
||||
}
|
||||
|
||||
this._super.apply(this, arguments);
|
||||
@ -101,6 +107,9 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
$j(node).bind("change.et2_inputWidget", this, function(e) {
|
||||
e.data.change.call(e.data, this);
|
||||
});
|
||||
$j(node).bind("focus", this, function(e) {
|
||||
e.data.focus.call(e.data, this);
|
||||
});
|
||||
}
|
||||
|
||||
this._super.apply(this,arguments);
|
||||
@ -138,6 +147,25 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
}
|
||||
return valid;
|
||||
},
|
||||
|
||||
focus: function(_node)
|
||||
{
|
||||
if (this.options.onfocus)
|
||||
{
|
||||
if(typeof this.options.onfocus == 'function')
|
||||
{
|
||||
// Make sure function gets a reference to the widget
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
if(args.indexOf(this) == -1) args.push(this);
|
||||
|
||||
return this.options.onfocus.apply(this, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (et2_compileLegacyJS(this.options.onfocus, this, _node))();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
set_value: function(_value) {
|
||||
|
||||
|
@ -187,6 +187,12 @@ var et2_taglist = et2_selectbox.extend(
|
||||
this.click(event.target, $j(event.target).parent().data("json"));
|
||||
},this));
|
||||
}
|
||||
|
||||
// onFocus
|
||||
if (this.options.onfocus)
|
||||
{
|
||||
$j(this.taglist).on("focus", jQuery.proxy(this.focus,this));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user