Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions dist/js/dselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ function dselectSearch(event, input, classElement, classToggler, creatable) {
item.classList.add("d-none");
}
}
for (const header of headers) {
const filterText = header.textContent;
if (filterText.toLowerCase().indexOf(filterValue) > -1) {
header.classList.remove("d-none");
let item = header;
while (item = item.nextElementSibling) {
if (item.classList.contains("dropdown-header")) {
break;
}
item.classList.remove("d-none");
}
}
}
const found = Array.from(items).filter((i) => !i.classList.contains("d-none") && !i.hasAttribute("hidden"));
if (found.length < 1) {
noResults.classList.remove("d-none");
Expand Down
26 changes: 13 additions & 13 deletions dist/js/dselect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions source/js/dselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ function dselectSearch(event, input, classElement, classToggler, creatable) {
item.classList.add('d-none')
}
}
for (const header of headers) {
const filterText = header.textContent

if (filterText.toLowerCase().indexOf(filterValue) > -1) {
header.classList.remove("d-none")
let item = header
while (item = item.nextElementSibling) {
if (item.classList.contains("dropdown-header")) {
break
}
item.classList.remove("d-none")
}
}
}
const found = Array.from(items).filter(i => !i.classList.contains('d-none') && !i.hasAttribute('hidden'))
if (found.length < 1) {
noResults.classList.remove('d-none')
Expand Down