FilamentF
Filament2y ago
Noxo

Pagination inside modal

Any idea how to implement pagination inside modal?
It would be ideal to implement infinite scrolling, but this is still a dream.

i tried a way with pagination component but got redirect to - https://demo.test/livewire/update?page=3

with error:

The GET method is not supported for route livewire/update. Supported methods: POST.


My code:

Action class
class StockHistory extends Action
{
    public static function getDefaultName(): ?string
    {
        return 'stock-history';
    }

    protected function setUp(): void
    {
        parent::setUp();

        $this->label(__('admin.actions.stock_history.label'));
        $this->modalHeading(__('admin.actions.stock_history.heading'));
        $this->slideOver();
        $this->modalSubmitAction(false);
        $this->modalCancelAction(false);
        $this->color(ColorService::blue());
        $this->modalWidth(MaxWidth::Medium);
        $this->modalContent(function ($record): View {
            $history = $record->stockHistory()->paginate(4);

            return view('filament.stock-history', ['history' => $history]);
        });
    }
}



Template file
{{ $history }}

<x-filament::pagination :paginator="$history" />
Solution
Livewire Infinite Scrolling. 🤌🏻

Twitter

3/4/24, 8:19 AM

Was this page helpful?