33namespace WireTable ;
44
55use Illuminate \Contracts \Database \Query \Builder ;
6+ use Illuminate \Contracts \Pagination \Paginator ;
67use Illuminate \Contracts \View \View ;
8+ use Livewire \Attributes \Computed ;
79use Livewire \Attributes \On ;
810use Livewire \Component ;
911use WireTable \Data \Column ;
@@ -43,7 +45,13 @@ public function renderTable(): View
4345 return view ('wire-table::layout ' )->with ($ this ->layoutData ());
4446 }
4547
46- protected function layoutData (): array
48+ #[On('wiretable:reload ' )]
49+ public function reload ()
50+ {
51+ }
52+
53+ #[Computed]
54+ public function paginatedData (): Paginator
4755 {
4856 $ query = $ this ->query ();
4957 $ query = $ this ->filter ($ query );
@@ -52,21 +60,18 @@ protected function layoutData(): array
5260 $ query = $ this ->applySorting ($ query );
5361 }
5462
55- $ paginator = $ this ->paginator ($ query );
63+ return $ this ->paginator ($ query );
64+ }
5665
66+ protected function layoutData (): array
67+ {
5768 return [
58- 'paginator ' => $ paginator ,
69+ 'paginator ' => $ this -> paginatedData ,
5970 'theme ' => $ this ->theme (),
6071 'iconTheme ' => $ this ->iconTheme (),
6172 ];
6273 }
6374
64- #[On('wiretable:reload ' )]
65- public function reload ()
66- {
67-
68- }
69-
7075 protected function theme (): string
7176 {
7277 $ theme = $ this ->theme ?? config ('wire-table.theme ' );
0 commit comments