coryrose1/livewire-tables

Issue/Conflict with Livewire\HasPagination trait

coryrose1 opened this issue · 1 comments

Something in the table component is overriding the WithPagination trait provided by Livewire.

The pagination view being loaded is actually the default Laravel / Bootstrap view. This results in full-page reloads / going to ?page=[number] in the URL. It also ceases to work after any Livewire method is run (i.e. sort or search then try pagination and it will result in an error).

There is an initializeWithPagination() method in the trait that does the following:

public function initializeWithPagination()
    {
        Paginator::currentPageResolver(function () {
            return $this->paginator['page'];
        });

        Paginator::defaultView('livewire::pagination-links');
    }

Pagination::defaultView() is not taking effect unless placed directly into AppServiceProvider.

However even when set, the Livewire pagination is not functioning correctly.

Can anyone identify why the pagination trait should be affected, by either LivewireModelTable component or the user-generated table component? If anyone can help me dig into this, I'd appreciate it.

This issue is now resolved. LivewireModelTable had to construct the parent Livewire component for pagination to function.