mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-10 01:28:16 -06:00
Addressed PR comments
This commit is contained in:
parent
6438daa0a0
commit
8f67b9b640
@ -53,26 +53,23 @@ export function initQuickSearch(): void {
|
||||
const clearbtn = document.getElementById("quicksearch_clear") as HTMLAnchorElement;
|
||||
if (isTruthy(quicksearch)) {
|
||||
quicksearch.addEventListener("keyup", quickSearchEventHandler, {
|
||||
passive: true,
|
||||
passive: true
|
||||
});
|
||||
quicksearch.addEventListener("search", quickSearchEventHandler, {
|
||||
passive: true,
|
||||
passive: true
|
||||
});
|
||||
quicksearch.addEventListener("change", handleQuickSearchParams);
|
||||
|
||||
if (isTruthy(clearbtn)) {
|
||||
clearbtn.addEventListener(
|
||||
"click",
|
||||
async () => {
|
||||
const search = new Event("search");
|
||||
quicksearch.value = "";
|
||||
clearbtn.addEventListener("click", async () => {
|
||||
const search = new Event('search');
|
||||
quicksearch.value = '';
|
||||
await new Promise(f => setTimeout(f, 100));
|
||||
quicksearch.dispatchEvent(search);
|
||||
},
|
||||
{
|
||||
passive: true,
|
||||
},
|
||||
);
|
||||
passive: true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="col-auto d-print-none">
|
||||
<div class="input-group input-group-flat me-2 quicksearch" hx-disinherit="hx-select hx-swap">
|
||||
<input type="search" results="5" name="q" id="quicksearch" class="form-control px-2 py-1" placeholder="Quick search"
|
||||
hx-get="{{ request.full_path }}" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search" id="quicksearch" />
|
||||
hx-get="{{ request.full_path }}" hx-target="#object_list" hx-trigger="keyup changed delay:500ms, search" />
|
||||
<span class="input-group-text py-1">
|
||||
<a href="#" id="quicksearch_clear" class="invisible text-secondary"><i class="mdi mdi-close-circle"></i></a>
|
||||
</span>
|
||||
|
Loading…
Reference in New Issue
Block a user