|
39 | 39 |
|
40 | 40 | let fromDateInput = $state(''); |
41 | 41 | let toDateInput = $state(''); |
| 42 | + let datePickerResetKey = $state(0); |
42 | 43 | let appliedFilters = $state<DateFilterState>({ |
43 | 44 | fromDate: '', |
44 | 45 | toDate: '' |
|
167 | 168 | function clearFilters() { |
168 | 169 | fromDateInput = ''; |
169 | 170 | toDateInput = ''; |
| 171 | + datePickerResetKey += 1; |
170 | 172 | const cleared: DateFilterState = { |
171 | 173 | fromDate: '', |
172 | 174 | toDate: '' |
|
198 | 200 | onreset={resetFilters} |
199 | 201 | > |
200 | 202 | <div class="result-grid__filters-row result-grid__filters-row--main"> |
201 | | - <div class="result-grid__filters-fields"> |
202 | | - <DatePicker> |
203 | | - <DatePickerInput |
204 | | - id="result-grid-from-date" |
205 | | - size="sm" |
206 | | - labelText="From date" |
207 | | - placeholder="mm/dd/yyyy" |
208 | | - bind:value={fromDateInput} |
209 | | - on:input={(event) => { |
210 | | - fromDateInput = readInputValue(event); |
211 | | - }} |
212 | | - > |
213 | | - <span slot="labelText" class="result-grid__date-label"> |
214 | | - <span>From date</span> |
215 | | - <TooltipIcon |
216 | | - tooltipText="Starting from midnight on the specified start date" |
217 | | - > |
218 | | - <Information /> |
219 | | - </TooltipIcon> |
220 | | - </span> |
221 | | - </DatePickerInput> |
222 | | - </DatePicker> |
223 | | - <DatePicker> |
224 | | - <DatePickerInput |
225 | | - id="result-grid-to-date" |
226 | | - size="sm" |
227 | | - labelText="To date" |
228 | | - placeholder="mm/dd/yyyy" |
229 | | - bind:value={toDateInput} |
230 | | - on:input={(event) => { |
231 | | - toDateInput = readInputValue(event); |
232 | | - }} |
233 | | - > |
234 | | - <span slot="labelText" class="result-grid__date-label"> |
235 | | - <span>To date</span> |
236 | | - <TooltipIcon |
237 | | - tooltipText="Up to (but not including) the specified end date" |
238 | | - > |
239 | | - <Information /> |
240 | | - </TooltipIcon> |
241 | | - </span> |
242 | | - </DatePickerInput> |
243 | | - </DatePicker> |
244 | | - </div> |
| 203 | + {#key datePickerResetKey} |
| 204 | + <div class="result-grid__filters-fields"> |
| 205 | + <DatePicker> |
| 206 | + <DatePickerInput |
| 207 | + id="result-grid-from-date" |
| 208 | + size="sm" |
| 209 | + labelText="From date" |
| 210 | + placeholder="mm/dd/yyyy" |
| 211 | + bind:value={fromDateInput} |
| 212 | + on:input={(event) => { |
| 213 | + fromDateInput = readInputValue(event); |
| 214 | + }} |
| 215 | + > |
| 216 | + <span slot="labelText" class="result-grid__date-label"> |
| 217 | + <span>From date</span> |
| 218 | + <TooltipIcon |
| 219 | + tooltipText="Starting from midnight on the specified start date" |
| 220 | + > |
| 221 | + <Information /> |
| 222 | + </TooltipIcon> |
| 223 | + </span> |
| 224 | + </DatePickerInput> |
| 225 | + </DatePicker> |
| 226 | + <DatePicker> |
| 227 | + <DatePickerInput |
| 228 | + id="result-grid-to-date" |
| 229 | + size="sm" |
| 230 | + labelText="To date" |
| 231 | + placeholder="mm/dd/yyyy" |
| 232 | + bind:value={toDateInput} |
| 233 | + on:input={(event) => { |
| 234 | + toDateInput = readInputValue(event); |
| 235 | + }} |
| 236 | + > |
| 237 | + <span slot="labelText" class="result-grid__date-label"> |
| 238 | + <span>To date</span> |
| 239 | + <TooltipIcon |
| 240 | + tooltipText="Up to (but not including) the specified end date" |
| 241 | + > |
| 242 | + <Information /> |
| 243 | + </TooltipIcon> |
| 244 | + </span> |
| 245 | + </DatePickerInput> |
| 246 | + </DatePicker> |
| 247 | + </div> |
| 248 | + {/key} |
245 | 249 | <div class="result-grid__filters-actions"> |
246 | 250 | {#if isReloadingData && hasInitiallyLoaded} |
247 | 251 | <div class="result-grid__soft-loading" aria-live="polite"> |
|
0 commit comments