Etemplate: Fix some selectAccount bugs when multiple=true

This commit is contained in:
nathangray 2020-09-15 11:23:02 -06:00
parent a19e97df63
commit 39b630d36e
4 changed files with 14 additions and 9 deletions

View File

@ -619,7 +619,9 @@ var et2_link_entry = /** @class */ (function (_super) {
select: function (event, item) {
event.data = self;
// Correct changed value from server
item.item.value = item.item.value.trim();
if (item.item.value) {
item.item.value = ("" + item.item.value).trim();
}
self.select(event, item);
return false;
},

View File

@ -804,7 +804,10 @@ export class et2_link_entry extends et2_inputWidget
{
event.data = self;
// Correct changed value from server
item.item.value = item.item.value.trim();
if(item.item.value)
{
item.item.value = (""+item.item.value).trim();
}
self.select(event,item);
return false;
},

View File

@ -326,10 +326,10 @@ var et2_selectAccount = /** @class */ (function (_super) {
// Add to list
ids.push(id);
// Make sure option is there
if (!widget.options.multiple && jQuery('input[id$="_opt_' + id + '"]', widget.multiOptions).length == 0) {
if (widget.options.multiple && jQuery('input[id$="_opt_' + id + '"]', widget.multiOptions).length == 0) {
widget._appendMultiOption(id, jQuery('label', this).text());
}
else if (widget.options.multiple && jQuery('option[value="' + id + '"]', widget.node).length == 0) {
else if (!widget.options.multiple && jQuery('option[value="' + id + '"]', widget.node).length == 0) {
widget._appendOptionElement(id, jQuery('label', this).text());
}
});
@ -395,7 +395,7 @@ var et2_selectAccount = /** @class */ (function (_super) {
self._appendOptionElement(selected.item.value, selected.item.label);
}
self.set_value(selected.item.value);
if (self.dialog) {
if (self.dialog && self.dialog.div) {
self.dialog.div.dialog("close");
}
// Fire change event

View File

@ -405,11 +405,11 @@ export class et2_selectAccount extends et2_selectbox
ids.push(id);
// Make sure option is there
if(!widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0)
if(widget.options.multiple && jQuery('input[id$="_opt_'+id+'"]',widget.multiOptions).length == 0)
{
widget._appendMultiOption(id,jQuery('label',this).text());
}
else if (widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0)
else if (!widget.options.multiple && jQuery('option[value="'+id+'"]',widget.node).length == 0)
{
widget._appendOptionElement(id,jQuery('label',this).text());
}
@ -495,7 +495,7 @@ export class et2_selectAccount extends et2_selectbox
self._appendOptionElement(selected.item.value, selected.item.label);
}
self.set_value(selected.item.value);
if(self.dialog)
if(self.dialog && self.dialog.div)
{
self.dialog.div.dialog("close");
}