Skip to content

Commit 955dd92

Browse files
marionfromfranceMarion MJI
andauthored
[contribution-issue-315] Fix column filtering while on page > 1 (marionfromfrance) (MedicOneSystems#319)
Co-authored-by: Marion MJI <marion.jiroff@tkblueagency.eu>
1 parent f1873c5 commit 955dd92

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

src/Http/Livewire/LivewireDatatable.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function resetTable()
155155
{
156156
$this->perPage = config('livewire-datatables.default_per_page', 10);
157157
$this->search = null;
158-
$this->page = 1;
158+
$this->setPage(1);
159159
$this->activeSelectFilters = [];
160160
$this->activeDateFilters = [];
161161
$this->activeTimeFilters = [];
@@ -168,7 +168,7 @@ public function resetTable()
168168

169169
public function updatedSearch()
170170
{
171-
$this->page = 1;
171+
$this->setPage(1);
172172
}
173173

174174
public function mount(
@@ -677,7 +677,7 @@ public function updatingPerPage()
677677

678678
public function refreshLivewireDatatable()
679679
{
680-
$this->page = 1;
680+
$this->setPage(1);
681681
}
682682

683683
/**
@@ -702,7 +702,7 @@ public function sort($index, $direction = null)
702702
} else {
703703
$this->sort = (int) $index;
704704
}
705-
$this->page = 1;
705+
$this->setPage(1);
706706

707707
session()->put([
708708
$this->sessionStorageKey() . '_sort' => $this->sort,
@@ -769,14 +769,14 @@ public function isGroupHidden($group)
769769
public function doBooleanFilter($index, $value)
770770
{
771771
$this->activeBooleanFilters[$index] = $value;
772-
$this->page = 1;
772+
$this->setPage(1);
773773
$this->setSessionStoredFilters();
774774
}
775775

776776
public function doSelectFilter($index, $value)
777777
{
778778
$this->activeSelectFilters[$index][] = $value;
779-
$this->page = 1;
779+
$this->setPage(1);
780780
$this->setSessionStoredFilters();
781781
}
782782

@@ -786,51 +786,51 @@ public function doTextFilter($index, $value)
786786
$this->activeTextFilters[$index][] = $val;
787787
}
788788

789-
$this->page = 1;
789+
$this->setPage(1);
790790
$this->setSessionStoredFilters();
791791
}
792792

793793
public function doDateFilterStart($index, $start)
794794
{
795795
$this->activeDateFilters[$index]['start'] = $start;
796-
$this->page = 1;
796+
$this->setPage(1);
797797
$this->setSessionStoredFilters();
798798
}
799799

800800
public function doDateFilterEnd($index, $end)
801801
{
802802
$this->activeDateFilters[$index]['end'] = $end;
803-
$this->page = 1;
803+
$this->setPage(1);
804804
$this->setSessionStoredFilters();
805805
}
806806

807807
public function doTimeFilterStart($index, $start)
808808
{
809809
$this->activeTimeFilters[$index]['start'] = $start;
810-
$this->page = 1;
810+
$this->setPage(1);
811811
$this->setSessionStoredFilters();
812812
}
813813

814814
public function doTimeFilterEnd($index, $end)
815815
{
816816
$this->activeTimeFilters[$index]['end'] = $end;
817-
$this->page = 1;
817+
$this->setPage(1);
818818
$this->setSessionStoredFilters();
819819
}
820820

821821
public function doNumberFilterStart($index, $start)
822822
{
823823
$this->activeNumberFilters[$index]['start'] = ($start != '') ? (int) $start : null;
824824
$this->clearEmptyNumberFilter($index);
825-
$this->page = 1;
825+
$this->setPage(1);
826826
$this->setSessionStoredFilters();
827827
}
828828

829829
public function doNumberFilterEnd($index, $end)
830830
{
831831
$this->activeNumberFilters[$index]['end'] = ($end != '') ? (int) $end : null;
832832
$this->clearEmptyNumberFilter($index);
833-
$this->page = 1;
833+
$this->setPage(1);
834834
$this->setSessionStoredFilters();
835835
}
836836

@@ -839,7 +839,7 @@ public function clearEmptyNumberFilter($index)
839839
if ((! isset($this->activeNumberFilters[$index]['start']) || $this->activeNumberFilters[$index]['start'] == '') && (! isset($this->activeNumberFilters[$index]['end']) || $this->activeNumberFilters[$index]['end'] == '')) {
840840
$this->removeNumberFilter($index);
841841
}
842-
$this->page = 1;
842+
$this->setPage(1);
843843
$this->setSessionStoredFilters();
844844
}
845845

@@ -849,7 +849,7 @@ public function removeSelectFilter($column, $key = null)
849849
if (count($this->activeSelectFilters[$column]) < 1) {
850850
unset($this->activeSelectFilters[$column]);
851851
}
852-
$this->page = 1;
852+
$this->setPage(1);
853853
$this->setSessionStoredFilters();
854854
}
855855

@@ -863,7 +863,7 @@ public function clearAllFilters()
863863
$this->activeNumberFilters = [];
864864
$this->complexQuery = null;
865865
$this->userFilter = null;
866-
$this->page = 1;
866+
$this->setPage(1);
867867
$this->setSessionStoredFilters();
868868

869869
$this->emitTo('complex-query', 'resetQuery');
@@ -1099,7 +1099,7 @@ public function addComplexQuery()
10991099
$this->processNested($this->complexQuery, $query);
11001100
});
11011101

1102-
$this->page = 1;
1102+
$this->setPage(1);
11031103

11041104
return $this;
11051105
}

0 commit comments

Comments
 (0)