mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
only trigger change event for real changes, first initialisation of widget is NOT considered a change
this modification might be necessary in more widgets, because they are either not an et2_inputWidget or overwrote set_value method
This commit is contained in:
parent
37a39dfe87
commit
5e2d655d40
@ -68,7 +68,8 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
this._oldValue = "";
|
||||
// mark value as not initialised, so set_value can determine if it is necessary to trigger change event
|
||||
this._oldValue = et2_no_init;
|
||||
this._labelContainer = null;
|
||||
},
|
||||
|
||||
@ -166,13 +167,20 @@ var et2_inputWidget = et2_valueWidget.extend([et2_IInput,et2_ISubmitListener],
|
||||
}
|
||||
},
|
||||
|
||||
set_value: function(_value) {
|
||||
|
||||
/**
|
||||
* Set value of widget and trigger for real changes a change event
|
||||
*
|
||||
* First initialisation (_oldValue === et2_no_init) is NOT considered a change!
|
||||
*
|
||||
* @param {string} _value value to set
|
||||
*/
|
||||
set_value: function(_value)
|
||||
{
|
||||
var node = this.getInputNode();
|
||||
if (node)
|
||||
{
|
||||
$j(node).val(_value);
|
||||
if(this.isAttached())
|
||||
if(this.isAttached() && this._oldValue !== et2_no_init && this._oldValue !== _value)
|
||||
{
|
||||
$j(node).change();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user