Advertisement
Sebuahhobi98

datatables

Jul 15th, 2024
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.40 KB | Source Code | 0 0
  1. const tabel_dt = $("#table_1").DataTable({
  2.       initComplete: function() {
  3.         var api = this.api();
  4.         $('#mytable_filter input')
  5.           .off('.DT')
  6.           .on('keyup.DT', function(e) {
  7.             if (e.keyCode == 13) {
  8.               api.search(this.value).draw();
  9.             }
  10.           });
  11.       },
  12.       oLanguage: {
  13.         sProcessing: "loading..."
  14.       },
  15.       processing: true,
  16.       serverSide: true,
  17.       responsive: true,
  18.       ajax: {
  19.         url: "<?= base_url(); ?>admin/transaksi/json",
  20.         type: "POST",
  21.         dataType: 'json',
  22.       },
  23.       columns: [{
  24.           "data": "transaksi_id",
  25.           "orderable": true,
  26.           "responsivePriority": 1,
  27.         }, {
  28.           "data": "status",
  29.           "orderable": true,
  30.           "responsivePriority": 9,
  31.         }, {
  32.           "data": "waktu_create",
  33.           "orderable": true,
  34.           "responsivePriority": 10,
  35.         }, {
  36.           "data": "waktu_update"
  37.         },
  38.         {
  39.           "data": "action",
  40.           "orderable": false,
  41.           "className": "text-center",
  42.           "responsivePriority": 13,
  43.         },
  44.       ],
  45.       order: [
  46.         [0, 'desc']
  47.       ],
  48.       rowCallback: function(row, data, iDisplayIndex) {
  49.       }
  50.     });
  51.  
  52. tabel_dt.row.add({
  53.   transaksi_id: '1',
  54.   status: "Sukses",
  55.   waktu_create: ".....",
  56.   waktu_update: "....",
  57. }).draw(false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement