how to use Laravel Datatables by yajra with server-side

Поделиться
HTML-код
  • Опубликовано: 16 сен 2024
  • how to use Laravel Datatables by yajra with server-side
    install package
    composer require yajra/laravel-datatables-oracle
    config/app.php
    'Datatables' =] yajra\Datatables\Datatables::class,
    yajra\Datatables\DatatablesServiceProvider::class,
    index function
    use Datatables;
    if($request-]wantsJson())
    return Datatables::of(City::query())-]make(true);
    return view('admin.cities.index');
    inded.blade.php
    في الكومنتات

Комментарии • 1

  • @online_programming
    @online_programming  Год назад

    index.blade.php




    Id
    title en
    title ar




    $(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' }
    ]
    });
    });