Skip to content

Commit

Permalink
AllowDeleteDateRangeFilter (#1875)
Browse files Browse the repository at this point in the history
  • Loading branch information
lrljoe authored Aug 23, 2024
1 parent 6480f1a commit 32fe628
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions resources/js/laravel-livewire-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,21 @@ document.addEventListener('alpine:init', () => {
onChange: function (selectedDates, dateStr, instance) {
if (selectedDates.length > 1) {
var dates = dateStr.split(' ');

var wireDateArray = {};
window.childElementOpen = false;
window.filterPopoverOpen = false;
wireDateArray = { 'minDate': dates[0], 'maxDate': (typeof dates[2] === "undefined") ? dates[0] : dates[2] };
wire.set('filterComponents.' + filterKey, wireDateArray);
}

},
}),
changedValue: function(value) {
if (value.length < 5)
{
this.flatpickrInstance.setDate([]);
wire.set('filterComponents.' + filterKey, {});
}
},
setupWire() {
if (this.wireValues !== undefined) {
if (this.wireValues.minDate !== undefined && this.wireValues.maxDate !== undefined) {
Expand Down
Loading

0 comments on commit 32fe628

Please sign in to comment.