rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.76k stars 330 forks source link

Search doesn't work when page != 1 #10

Closed sjardim closed 4 years ago

sjardim commented 4 years ago

Hi, just installed to test and noticed that on the page is not the first one, the search returns no results.

Screenshot: Step 1 - Initial rendering on first page ![image](https://user-images.githubusercontent.com/125217/81083330-5bb16580-8eec-11ea-9815-1a8bf8ac0f51.png)
Screenshot: Step 2 - Searching for "goos" on first page Returns one row as expected. ![image](https://user-images.githubusercontent.com/125217/81083675-c95d9180-8eec-11ea-912e-2bb544cd1f2b.png)

But if we go to ?page=2, and search again for "goos" nothing is returned

sjardim commented 4 years ago

Maybe it can be fixed using the resetPage() method of Livewire's withPagination trait:

/*
     * Reset pagination when doing a search
     */
    public function updatingSearch()
    {
        $this->resetPage();
    }
rappasoft commented 4 years ago

I'll look into it

sjardim commented 4 years ago

Great, thank you!

rappasoft commented 4 years ago

@sjardim I'm adding that method to the plugin, it fixes the problem thanks.

rappasoft commented 4 years ago

https://github.com/rappasoft/laravel-livewire-tables/releases/tag/v0.1.3