Add clear button

This commit is contained in:
Jeremy Stretch 2024-01-26 17:31:09 -05:00
parent 93ad822b77
commit 1400065216
3 changed files with 4 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,9 @@ import TomSelect from 'tom-select';
function initStaticSelects(): void { function initStaticSelects(): void {
for (const select of getElements<HTMLSelectElement>('select:not(.api-select):not(.color-select)')) { for (const select of getElements<HTMLSelectElement>('select:not(.api-select):not(.color-select)')) {
new TomSelect(select, {}); new TomSelect(select, {
plugins: ['clear_button']
});
} }
} }
@ -15,6 +17,7 @@ function initDynamicSelects(): void {
for (const select of getElements<HTMLSelectElement>('select.api-select')) { for (const select of getElements<HTMLSelectElement>('select.api-select')) {
const api_url = select.getAttribute('data-url') as string; const api_url = select.getAttribute('data-url') as string;
new TomSelect(select, { new TomSelect(select, {
plugins: ['clear_button'],
valueField: 'id', valueField: 'id',
labelField: 'display', labelField: 'display',
searchField: ['name'], searchField: ['name'],