Я использую пакет таблиц данных Yajra для загрузки записей. Но я получаю записи на полной странице, а не на конкретной таблице. Я не понимаю, где находится ошибка.
просмотреть файл
<table id="clientsTable" class="table table-bordered table-striped dataTable">
<thead>
<tr>
<th>#</th>
<th>First name</th>
<!--<th>Last name</th>-->
<th>Mobile number</th>
<th>Email</th>
<th>Actions</th>
</tr>
</thead>
</table>
файл сценария
$(document).ready(function($) {
$('#menu-clients').addClass('active');
$('#clientsTable').DataTable({
processing: true,
serverSide: true,
"bDestroy": true,
"bAutoWidth": false,
ajax:{
url : '/clients',
method: 'get',
},
columns:[
{ data: 'DT_RowIndex'},
{ data: 'first_name', name: 'first_name'},
{ data: 'mobile_no', name: 'mobile_no'},
{ data: 'email', name: 'email'},
{ data: 'actions', name: 'actions'},
]
});
});
файл маршрута
Route::resource('/clients', 'ClientsController');
контроллер
public function index()
{
$data = DB::table('clients')->orderBy('id', 'desc')->get();
return Datatables::of($data)
->addColumn('actions','buttons.clients')
->rawColumns(['actions'])
->addIndexColumn()
->make(true);
}
ответ на вкладке сети
{draw: 0, recordsTotal: 166, recordsFiltered: 166, data: [,…], input: []}
draw: 0
recordsTotal: 166
recordsFiltered: 166
data: [,…]
[0 … 99]
[100 … 165]
input: []