File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -166,7 +166,7 @@ class="sr-only ml-2 text-sm font-medium text-gray-900 dark:text-gray-300"></labe
166166
167167 @if ($this -> isPaginated () && $this -> rows -> hasPages () )
168168 <div class =" border-b border-gray-200 shadow-sm" >
169- <div class =" py-2 px-6" >{{ $this -> rows -> links () } } </div >
169+ <div class =" py-2 px-6" >{{ $this -> rows -> links ([ ' scrollTo ' => $this -> shouldScroll ()] ) } } </div >
170170 </div >
171171 @endif
172172 @endif
Original file line number Diff line number Diff line change 110110 <div >
111111 @if ($this -> isPaginated () && $this -> rows -> hasPages () )
112112 <div class =" border-b border-gray-200 shadow-sm" >
113- <div class =" py-2 px-6" >{{ $this -> rows -> links () } } </div >
113+ <div class =" py-2 px-6" >{{ $this -> rows -> links ([ ' scrollTo ' => $this -> shouldScroll ()] ) } } </div >
114114 </div >
115115 @endif
116116 </div >
Original file line number Diff line number Diff line change @@ -12,13 +12,27 @@ trait WithPagination
1212
1313 private bool $ paginate = true ;
1414
15+ private bool $ scrollToTop = false ;
16+
1517 public function usePagination ($ usePagination = true ): static
1618 {
1719 $ this ->paginate = $ usePagination ;
1820
1921 return $ this ;
2022 }
2123
24+ public function scrollToTop ($ scrollToTop = true ): static
25+ {
26+ $ this ->scrollToTop = $ scrollToTop ;
27+
28+ return $ this ;
29+ }
30+
31+ public function shouldScroll (): bool
32+ {
33+ return $ this ->scrollToTop ;
34+ }
35+
2236 public function pageName ($ pageName = null ): static
2337 {
2438 $ this ->pageName = $ pageName ;
You can’t perform that action at this time.
0 commit comments