calebporzio/laracasts-livewire-datatable

[Question] How to jump to first page when entering a new search term?

ludgerey opened this issue · 2 comments

The following scenario: User browses through table (clicks some pages forward) and then starts searching using the search input. The user will see a blank table even if there are matching records. Thats because the page param is still on page 3 for example.

Would be better to jump to the first page when entering a new search term. How can I achieve that?

This is really a problem in this example! Howto solve ?

public function updatingSearch()
{
$this->resetPage();
}

OR

public function updatingSearch()
{
$currentPage = 1;

\Illuminate\Pagination\Paginator::currentPageResolver(function () use ($currentPage) {
    return $currentPage;
    });
}