I'm using JQuery DataTables on a small system and everything was fine until I came across a listing of almost 2500 records ...
The point is that it takes some time for the information to be loaded and adjusted in the DataTable, which causes it to load and display all 2500 records on the page until everything is loaded and paging takes effect.
Would there be any way to avoid / mask this? Currently I do not use ajax, I do so:
On my Controller:
public function index()
{
$funcoes = Funcao::orderBy('id')->get();
return view('cadastros/funcao/index', compact('funcoes'));
}
In my View:
<table id="appDatatable" class="table table-bordered table-hover">
<thead><tr><th>...</th></tr></thead>
<tbody>
@foreach($funcoes as $funcao)
<tr>
<td>{{ $funcao->cbo }}</td>
<td>{{ $funcao->nome }}</td>
...
</tr>
@endforeach
</tbody>
</table>
My script:
<script>
$(function () {
$("#appDatatable").DataTable({
sPaginationType: "simple_numbers",
});
});
</script>