fix issue with empty options displaying wrong
Some checks failed
Build and Push Docker Image / build (push) Failing after 7m3s
Some checks failed
Build and Push Docker Image / build (push) Failing after 7m3s
This commit is contained in:
parent
686596a8c1
commit
efd4452087
@ -114,8 +114,12 @@ $(document).ready(function() {
|
|||||||
const defaultSelectedHtml = " ";
|
const defaultSelectedHtml = " ";
|
||||||
|
|
||||||
const updateSelectedDisplay = ($select, $selected, $dropdown, settings) => {
|
const updateSelectedDisplay = ($select, $selected, $dropdown, settings) => {
|
||||||
const values = $select.val() || [];
|
let values = $select.val() || [];
|
||||||
const names = [];
|
let names = [];
|
||||||
|
|
||||||
|
// if (settings.id === "styleTitleMutator") { debugger; }
|
||||||
|
|
||||||
|
if (!Array.isArray(values)) { values = [values] };
|
||||||
|
|
||||||
// Update names based on values
|
// Update names based on values
|
||||||
$select.find("option").each(function() {
|
$select.find("option").each(function() {
|
||||||
@ -124,13 +128,13 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const len = Array.isArray(values) ? values.length : 1;
|
const len = values.length || 1;
|
||||||
const total = $select.find("option").length;
|
const total = $select.find("option").length;
|
||||||
|
|
||||||
if (len === 0) { $selected.html(defaultSelectedHtml); }
|
if (len === 0) { $selected.html(defaultSelectedHtml); }
|
||||||
else if (len === total && total > 3) {$selected.text("All Selected")}
|
else if (len === total && total > 3) {$selected.text("All Selected")}
|
||||||
else if (len > 3) { $selected.text(`${values.length} Selected`); }
|
else if (len > 3) { $selected.text(`${values.length} Selected`); }
|
||||||
else { $selected.text(names.join(", ")); }
|
else { names ? $selected.text(names.join(", ")) : $selected.html(defaultSelectedHtml); }
|
||||||
|
|
||||||
if (!settings.multiple) {
|
if (!settings.multiple) {
|
||||||
$dropdown.find(".corbz-select-option").removeClass("active").each(function() {
|
$dropdown.find(".corbz-select-option").removeClass("active").each(function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user