mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
handle selection resets
This commit is contained in:
@ -181,6 +181,9 @@ export function initApiSelect() {
|
|||||||
const groupBy = [] as HTMLSelectElement[];
|
const groupBy = [] as HTMLSelectElement[];
|
||||||
|
|
||||||
if (isCustomSelect(select)) {
|
if (isCustomSelect(select)) {
|
||||||
|
// Store the original URL, so it can be referred back to as filter-by elements change.
|
||||||
|
const originalUrl = JSON.parse(JSON.stringify(select.dataset.url)) as string;
|
||||||
|
// Unpack the original URL with the intent of reassigning it as context updates.
|
||||||
let { url } = select.dataset;
|
let { url } = select.dataset;
|
||||||
|
|
||||||
const placeholder = getPlaceholder(select);
|
const placeholder = getPlaceholder(select);
|
||||||
@ -297,6 +300,8 @@ export function initApiSelect() {
|
|||||||
query[name] = target.value;
|
query[name] = target.value;
|
||||||
// Create a URL with all relevant query parameters.
|
// Create a URL with all relevant query parameters.
|
||||||
url = queryString.stringifyUrl({ url, query });
|
url = queryString.stringifyUrl({ url, query });
|
||||||
|
} else {
|
||||||
|
url = originalUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable the element while data is loading.
|
// Disable the element while data is loading.
|
||||||
|
Reference in New Issue
Block a user