Make taglist-state update its own options when country code changes

Fixes bug where options were not properly set if they had to be fetched from server.
This commit is contained in:
nathangray 2020-05-13 15:21:26 -06:00
parent 46a3818e92
commit 934d309856
4 changed files with 14 additions and 4 deletions

View File

@ -485,8 +485,6 @@ var AddressbookApp = /** @class */ (function (_super) {
var region = this.et2.getWidgetById(selectbox.name.replace('countrycode', 'region')); var region = this.et2.getWidgetById(selectbox.name.replace('countrycode', 'region'));
if (region) { if (region) {
region.set_country_code(selectbox.value); region.set_country_code(selectbox.value);
region.options.select_options = {};
region.transformAttributes(region.options);
} }
}; };
/** /**

View File

@ -577,8 +577,6 @@ class AddressbookApp extends EgwApp
if (region) if (region)
{ {
region.set_country_code(selectbox.value); region.set_country_code(selectbox.value);
region.options.select_options = {};
region.transformAttributes(region.options);
} }
} }

View File

@ -1255,8 +1255,14 @@ var et2_taglist_state = /** @class */ (function (_super) {
}; };
et2_taglist_state.prototype.set_country_code = function (_country_code) { et2_taglist_state.prototype.set_country_code = function (_country_code) {
var country_code = _country_code || ''; var country_code = _country_code || '';
var old_code = this.options.country_code;
this.country_code = country_code; this.country_code = country_code;
this.options.country_code = country_code; this.options.country_code = country_code;
// Reload if needed
if (this.options.country_code !== old_code && this.isInTree()) {
var sel_options = et2_widget_selectbox_1.et2_selectbox.find_select_options(this, {}, this.options);
this.set_select_options(sel_options);
}
}; };
et2_taglist_state._attributes = { et2_taglist_state._attributes = {
"minChars": { "minChars": {

View File

@ -1478,8 +1478,16 @@ class et2_taglist_state extends et2_taglist
set_country_code(_country_code) set_country_code(_country_code)
{ {
let country_code = _country_code || ''; let country_code = _country_code || '';
let old_code = this.options.country_code;
this.country_code = country_code; this.country_code = country_code;
this.options.country_code = country_code; this.options.country_code = country_code;
// Reload if needed
if(this.options.country_code !== old_code && this.isInTree())
{
var sel_options = et2_selectbox.find_select_options(this, {}, this.options);
this.set_select_options(sel_options);
}
} }
} }
et2_register_widget(et2_taglist_state, ["taglist-state"]); et2_register_widget(et2_taglist_state, ["taglist-state"]);