Skip to content

Commit 97683e6

Browse files
committed
comment out cleanFilter() on getRowsQueryProperty(), auto-initialize filter parameter add wire:key
1 parent eea59ca commit 97683e6

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

resources/views/tailwind/includes/filters.blade.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class="origin-top-right absolute right-0 mt-2 w-full md:w-56 rounded-md shadow-l
5151
<div class="mt-1 relative rounded-md shadow-sm">
5252
<select
5353
wire:model="filters.{{ $key }}"
54+
wire:key="filter-{{ $key }}"
5455
id="filter-{{ $key }}"
5556
class="rounded-md shadow-sm block w-full pl-3 pr-10 py-2 text-base leading-6 border-gray-300 focus:outline-none focus:border-indigo-300 focus:shadow-outline-indigo sm:text-sm sm:leading-5"
5657
>

src/DataTableComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function __construct($id = null)
150150
*/
151151
public function getRowsQueryProperty(): Builder
152152
{
153-
$this->cleanFilters();
153+
//$this->cleanFilters();
154154

155155
return $this->applySorting($this->query());
156156
}

src/Traits/WithFilters.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ trait WithFilters
1313
'search' => null,
1414
];
1515

16+
public function mountWithFilters()
17+
{
18+
foreach($this->filters() as $filter => $options){
19+
if(!isset($this->filters[$filter])){
20+
$this->filters[$filter] = null;
21+
}
22+
}
23+
}
24+
1625
public function resetFilters(): void
1726
{
1827
$search = $this->filters['search'] ?? null;

0 commit comments

Comments
 (0)