Skip to content

Commit 0f86265

Browse files
committed
chore(demo): add reset lazy load button [refresh gh-pages]
1 parent c3c7416 commit 0f86265

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

packages/demo/src/options/options42.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ <h2 class="bd-title">
2020
<div class="demo-subtitle">
2121
Use <code>lazyLoad: callback</code> to lazy load data only after clicking and opening the select dropdown.
2222
Note that once the data is loaded, it no longer needs to be lazy loaded again and so re-opening the select dropdown will show instantly afterward.
23-
You can refresh the page, or change server delay, to retest the lazy loading.
24-
Also note that any option pre-selection will only show up after the data is fully loaded.
23+
You can refresh the page, or click the button to retest the lazy loading.
24+
Also note that any pre-selected options will only show up after the data is fully loaded.
2525
</div>
2626
</div>
2727
</div>
@@ -30,8 +30,9 @@ <h2 class="bd-title">
3030
<div class="mb-3 row">
3131
<label class="col-sm-2"> Server Delay (ms) </label>
3232

33-
<div class="col-sm-10">
34-
<input id="serverdelay" type="number" value="1000" step="100" style="width: 100px" />
33+
<div class="col-sm-10 d-flex align-items-center gap-2">
34+
<input id="serverdelay" type="number" value="1000" step="100" style="height: 34px; width: 100px;" />
35+
<button id="resetlazy" class="btn btn-outline-secondary btn-sm">Reset Lazy Load</button>
3536
</div>
3637
</div>
3738

packages/demo/src/options/options42.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { type MultipleSelectInstance, multipleSelect } from 'multiple-select-van
22

33
export default class Example {
44
serverDelayInput?: HTMLInputElement | null;
5+
resetLazyBtn?: HTMLButtonElement | null;
56
ms1?: MultipleSelectInstance;
67
ms2?: MultipleSelectInstance;
78
ms3?: MultipleSelectInstance;
@@ -15,7 +16,9 @@ export default class Example {
1516

1617
mount() {
1718
this.serverDelayInput = document.querySelector('#serverdelay');
19+
this.resetLazyBtn = document.querySelector('#resetlazy');
1820
this.serverDelayInput!.addEventListener('keyup', this.changeServerDelay.bind(this));
21+
this.resetLazyBtn!.addEventListener('click', this.createMultipleSelect.bind(this));
1922
this.createMultipleSelect();
2023
}
2124

@@ -202,5 +205,6 @@ export default class Example {
202205
this.ms2 = undefined;
203206
this.ms3 = undefined;
204207
this.serverDelayInput!.removeEventListener('click', this.changeServerDelay.bind(this));
208+
this.resetLazyBtn!.removeEventListener('click', this.createMultipleSelect.bind(this));
205209
}
206210
}

0 commit comments

Comments
 (0)