Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions src/Http/Livewire/LivewireDatatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function resetTable()
{
$this->perPage = config('livewire-datatables.default_per_page', 10);
$this->search = null;
$this->page = 1;
$this->setPage(1);
$this->activeSelectFilters = [];
$this->activeDateFilters = [];
$this->activeTimeFilters = [];
Expand All @@ -154,7 +154,7 @@ public function resetTable()

public function updatedSearch()
{
$this->page = 1;
$this->setPage(1);
}

public function mount(
Expand Down Expand Up @@ -624,7 +624,7 @@ public function updatingPerPage()

public function refreshLivewireDatatable()
{
$this->page = 1;
$this->setPage(1);
}

/**
Expand All @@ -649,7 +649,7 @@ public function sort($index, $direction = null)
} else {
$this->sort = (int) $index;
}
$this->page = 1;
$this->setPage(1);

$key = Str::snake(Str::afterLast(get_called_class(), '\\'));
session()->put([$key . $this->name . '_sort' => $this->sort, $key . $this->name . '_direction' => $this->direction]);
Expand Down Expand Up @@ -714,14 +714,14 @@ public function isGroupHidden($group)
public function doBooleanFilter($index, $value)
{
$this->activeBooleanFilters[$index] = $value;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doSelectFilter($index, $value)
{
$this->activeSelectFilters[$index][] = $value;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

Expand All @@ -731,51 +731,51 @@ public function doTextFilter($index, $value)
$this->activeTextFilters[$index][] = $val;
}

$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doDateFilterStart($index, $start)
{
$this->activeDateFilters[$index]['start'] = $start;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doDateFilterEnd($index, $end)
{
$this->activeDateFilters[$index]['end'] = $end;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doTimeFilterStart($index, $start)
{
$this->activeTimeFilters[$index]['start'] = $start;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doTimeFilterEnd($index, $end)
{
$this->activeTimeFilters[$index]['end'] = $end;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doNumberFilterStart($index, $start)
{
$this->activeNumberFilters[$index]['start'] = ($start != '') ? (int) $start : null;
$this->clearEmptyNumberFilter($index);
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

public function doNumberFilterEnd($index, $end)
{
$this->activeNumberFilters[$index]['end'] = ($end != '') ? (int) $end : null;
$this->clearEmptyNumberFilter($index);
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

Expand All @@ -784,7 +784,7 @@ public function clearEmptyNumberFilter($index)
if ((! isset($this->activeNumberFilters[$index]['start']) || $this->activeNumberFilters[$index]['start'] == '') && (! isset($this->activeNumberFilters[$index]['end']) || $this->activeNumberFilters[$index]['end'] == '')) {
$this->removeNumberFilter($index);
}
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

Expand All @@ -794,7 +794,7 @@ public function removeSelectFilter($column, $key = null)
if (count($this->activeSelectFilters[$column]) < 1) {
unset($this->activeSelectFilters[$column]);
}
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();
}

Expand All @@ -808,7 +808,7 @@ public function clearAllFilters()
$this->activeNumberFilters = [];
$this->complexQuery = null;
$this->userFilter = null;
$this->page = 1;
$this->setPage(1);
$this->setSessionStoredFilters();

$this->emitTo('complex-query', 'resetQuery');
Expand Down Expand Up @@ -1042,7 +1042,7 @@ public function addComplexQuery()
$this->processNested($this->complexQuery, $query);
});

$this->page = 1;
$this->setPage(1);

return $this;
}
Expand Down