Skip to content

Commit 09c9c89

Browse files
committed
make filter at product-properties work case insensitively
1 parent f0829bb commit 09c9c89

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

Themes/config/js/admin_product.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,13 +1053,19 @@ jQuery.fn.toggleOption = function (show) {
10531053
});
10541054
};
10551055

1056+
var filterSelectTimeout = null;
10561057
function filterSelect(searchbox, selectid) {
1057-
var s = $(searchbox).val();
1058-
$(`#${selectid} option`).each(function(index) {
1059-
if ($(this).text().indexOf(s) >= 0) {
1060-
$(this).toggleOption(true);
1061-
} else {
1062-
$(this).toggleOption(false);
1063-
}
1064-
});
1058+
if (filterSelectTimeout) {
1059+
clearTimeout(filterSelectTimeout);
1060+
}
1061+
filterSelectTimeout = setTimeout(function() {
1062+
var s = $(searchbox).val().toLowerCase();
1063+
$(`#${selectid} option`).each(function(index) {
1064+
if ($(this).attr("data-lowervalue").indexOf(s) >= 0) {
1065+
$(this).toggleOption(true);
1066+
} else {
1067+
$(this).toggleOption(false);
1068+
}
1069+
});
1070+
}, 500);
10651071
}

render/NBrightBuyRazorTokens.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -759,19 +759,19 @@ public IEncodedString CategorySelectList(NBrightInfo info, String xpath, String
759759

760760
if (addSearchBox)
761761
{
762-
strOut += $"<div class=\"form-group\"><label>{ResourceKey("General.PropertyGroupSearchLabel")}</label><input type=\"text\" class=\"form-control\" onkeyup=\"filterSelect(this, '{id}')\" ></div>";
762+
strOut += $"<div class=\"form-group\"><label>{ResourceKey("General.PropertyGroupSearchLabel")}</label><input type=\"text\" class=\"form-control\" onkeyup=\"filterSelect(this, '{id}')\" ></div>\r\n";
763763
}
764764

765-
strOut += "<div class=\"form-group\"><select id='" + id + "' " + upd + " " + attributes + ">";
765+
strOut += "<div class=\"form-group\"><select id='" + id + "' " + upd + " " + attributes + ">\r\n";
766766
var s = "";
767-
if (allowEmpty) strOut += " <option value=''></option>";
767+
if (allowEmpty) strOut += " <option value=''></option>\r\n";
768768
foreach (var tItem in rtnList)
769769
{
770770
if (info.GetXmlProperty(xpath) == tItem.Key.ToString())
771771
s = "selected";
772772
else
773773
s = "";
774-
strOut += " <option value='" + tItem.Key.ToString() + "' " + s + ">" + tItem.Value + "</option>";
774+
strOut += $" <option value='{tItem.Key}' data-lowervalue=\"{tItem.Value.ToLowerInvariant()}\" {s}>{tItem.Value}</option>\r\n";
775775
}
776776
strOut += "</select></div>";
777777
strOut += "</div>";

0 commit comments

Comments
 (0)