how to use Laravel Datatables by yajra with server-side

preview_player
Показать описание
how to use Laravel Datatables by yajra with server-side

install package
composer require yajra/laravel-datatables-oracle

'Datatables' =] yajra\Datatables\Datatables::class,
yajra\Datatables\DatatablesServiceProvider::class,

index function
use Datatables;

if($request-]wantsJson())
return Datatables::of(City::query())-]make(true);

في الكومنتات
Рекомендации по теме
Комментарии
Автор

index.blade.php

<table class="table table-bordered table-striped" id="table">
<thead>
<tr>
<th>Id</th>
<th>title en</th>
<th>title ar</th>
</tr>
</thead>
</table>

<script>
$(function() {
$('#table').DataTable({
processing: true,
serverSide: true,
ajax: '{{ route('cities.index') }}',
columns: [
{ data: 'id', name: 'id' },
{ data: 'title_en', name: 'title_en' },
{ data: 'title_ar', name: 'title_ar' }
]
});
});
</script>

online_programming