mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-07 16:18:16 -06:00
16959 fix filter reset button
This commit is contained in:
parent
09d36469dd
commit
233173c225
BIN
netbox/project-static/dist/netbox.js
vendored
BIN
netbox/project-static/dist/netbox.js
vendored
Binary file not shown.
BIN
netbox/project-static/dist/netbox.js.map
vendored
BIN
netbox/project-static/dist/netbox.js.map
vendored
Binary file not shown.
@ -7,7 +7,7 @@ import { DynamicParamsMap } from './dynamicParamsMap';
|
||||
|
||||
// Transitional
|
||||
import { QueryFilter, PathFilter } from '../types'
|
||||
import { getElement, replaceAll } from '../../util';
|
||||
import { findFirstAdjacent, getElement, replaceAll } from '../../util';
|
||||
|
||||
|
||||
// Extends TomSelect to provide enhanced fetching of options via the REST API
|
||||
@ -68,6 +68,9 @@ export class DynamicTomSelect extends TomSelect {
|
||||
this.updatePathValues(filter);
|
||||
}
|
||||
|
||||
// Initialize controlling elements.
|
||||
this.initResetButton();
|
||||
|
||||
// Add dependency event listeners.
|
||||
this.addEventListeners();
|
||||
}
|
||||
@ -311,6 +314,20 @@ export class DynamicTomSelect extends TomSelect {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize any adjacent reset buttons so that when clicked, the page is reloaded without
|
||||
* query parameters.
|
||||
*/
|
||||
private initResetButton(): void {
|
||||
const resetButton = document.querySelector<HTMLButtonElement>('button[data-reset-select]');
|
||||
|
||||
if (resetButton !== null) {
|
||||
resetButton.addEventListener('click', () => {
|
||||
window.location.assign(window.location.origin + window.location.pathname);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Events
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user