- Fix missing onchange trigger on selectboxes

- Avoid loops caused by onchange trigger when applying filters
This commit is contained in:
Nathan Gray 2015-03-31 16:23:41 +00:00
parent 3037724641
commit 6671f4090a
2 changed files with 11 additions and 1 deletions

View File

@ -405,6 +405,10 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
applyFilters: function(_set) { applyFilters: function(_set) {
var changed = false; var changed = false;
// Avoid loops cause by change events
if(this.update_in_progress) return;
this.update_in_progress = true;
// Cleared explicitly // Cleared explicitly
if(typeof _set != 'undefined' && jQuery.isEmptyObject(_set)) if(typeof _set != 'undefined' && jQuery.isEmptyObject(_set))
{ {
@ -496,6 +500,8 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput, et2_IPrin
// Trigger an update // Trigger an update
this.controller.update(true); this.controller.update(true);
this.update_in_progress = false;
}, },
/** /**

View File

@ -447,6 +447,7 @@ var et2_selectbox = et2_inputWidget.extend(
// No options set yet // No options set yet
this.set_select_options(this.options.select_options); this.set_select_options(this.options.select_options);
} }
this._oldValue = this.value;
if(this.input !== null && (this.options.tags || this.options.search)) if(this.input !== null && (this.options.tags || this.options.search))
{ {
// Value must be a real Array, not an object // Value must be a real Array, not an object
@ -499,7 +500,10 @@ var et2_selectbox = et2_inputWidget.extend(
return; return;
} }
} }
if(this.isAttached() && this._oldValue !== et2_no_init && this._oldValue !== _value)
{
this.input.change();
}
this.value = _value; this.value = _value;
}, },