Hi,
So I integrated pagination for my tables, but is there any simple way (without AJAX) to make clicking the next page of the table stop going to the top of the page?
Route:
Route::get('/beheerder', [UserController::class, 'showModPage'])->middleware('auth', 'IsVerified', 'MustBeAdmin');
Blade template:
<table class="table table-striped table-bordered table-hover" id="options">
<strong>Lijst van opties:</strong>
<br><br>
<thead class="thead-dark">
<tr>
<th><strong>Geslachtsnaam</strong></th>
<th><strong>Soortnaam</strong></th>
<th><strong>Vangplaats</strong></th>
</tr>
</thead>
<tbody id="table-data">
@foreach ($options as $option)
<tr>
<td> {{ $option->geslachtsnaam }}</td>
<td> {{ $option->soortnaam }}</td>
<td> {{ $option->vangplaats }}</td>
</tr>
@endforeach
<tr>
<td colspan="3">
{{ $options->links() }}
</td>
</tr>
</tbody>
</table>
Controller method:
public function showModPage(User $users, Options $options, Registratie $registraties) {
$options = DB::table('options')->paginate(5);
return view('/beheerder', [
'options' => $options,
]);
}