Skip to content

Commit 32fe628

Browse files
authored
AllowDeleteDateRangeFilter (rappasoft#1875)
1 parent 6480f1a commit 32fe628

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

resources/js/laravel-livewire-tables.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,16 +334,21 @@ document.addEventListener('alpine:init', () => {
334334
onChange: function (selectedDates, dateStr, instance) {
335335
if (selectedDates.length > 1) {
336336
var dates = dateStr.split(' ');
337-
338337
var wireDateArray = {};
339338
window.childElementOpen = false;
340339
window.filterPopoverOpen = false;
341340
wireDateArray = { 'minDate': dates[0], 'maxDate': (typeof dates[2] === "undefined") ? dates[0] : dates[2] };
342341
wire.set('filterComponents.' + filterKey, wireDateArray);
343342
}
344-
345343
},
346344
}),
345+
changedValue: function(value) {
346+
if (value.length < 5)
347+
{
348+
this.flatpickrInstance.setDate([]);
349+
wire.set('filterComponents.' + filterKey, {});
350+
}
351+
},
347352
setupWire() {
348353
if (this.wireValues !== undefined) {
349354
if (this.wireValues.minDate !== undefined && this.wireValues.maxDate !== undefined) {

0 commit comments

Comments
 (0)