Advertisement
aantamimmaarif

blade datatable

Jul 6th, 2022
925
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.94 KB | None
  1. <table class="table table-bordered table-striped" id="data-table">
  2.     <thead>
  3.         <tr>
  4.             <th style="width: 40px;">No</th>
  5.             <th>Mekanik</th>
  6.             <th>Kategori Mekanik</th>
  7.             <th>Action</th>
  8.         </tr>
  9.     </thead>
  10. </table>
  11.  
  12. <script>
  13. $(document).ready(function() {
  14.     // Crsf
  15.     $.ajaxSetup({
  16.         headers: {
  17.             'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
  18.         }
  19.     });
  20.   });
  21.  
  22. var table = $('#data-table').DataTable({
  23.         processing: true,
  24.         serverSide: true,
  25.         bSort: false,
  26.         ajax: "{{ route('mesin-mekanik.index') }}",
  27.         columns: [
  28.             {data: 'DT_RowIndex', name: 'DT_RowIndex'},
  29.             { data: 'nama_mekanik', name: 'nama_mekanik' },
  30.             { data: 'nama_kategori', name: 'nama_kategori' },
  31.             {data: 'action', name: 'action', orderable: false, searchable: false},
  32.         ]
  33.     });
  34.  
  35. </script>
Advertisement
RAW Paste Data Copied
Advertisement