Advertisement
jamboljack

Datatables Server Side

Oct 5th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. $(document).ready(function() {
  2.     table = $('#tableData').DataTable({
  3.         "responsive": true,
  4.         "processing": false,
  5.         "serverSide": true,
  6.         "order": [2, 'asc'],
  7.         "lengthMenu": [
  8.                 [20, 50, 75, 100, -1],
  9.                 [20, 50, 75, 100, "All"]
  10.         ],
  11.         "pageLength": 20,
  12.         "ajax": {
  13.             "url": "<?php echo site_url('admin/rtlh/pengajuan/data_list/'.$this->uri->segment(4).'/'.$this->uri->segment(5)); ?>",
  14.             "type": "POST",
  15.             "data": function(data) {
  16.                 data.lstStatusUsulan    = $('#lstStatusUsulan').val();
  17.                 data.lstStatusRTLH      = $('#lstStatusRTLH').val();
  18.             }
  19.         },
  20.         "columnDefs": [
  21.         {
  22.             "targets": [ 0 ],
  23.             "orderable": false,
  24.         },
  25.         ],
  26.     });
  27.  
  28.     $('#btn-filter').click(function() {
  29.         table.ajax.reload();
  30.         $('#filterData').modal('hide');
  31.     });
  32.  
  33.     $('#btn-reset').click(function() {
  34.         $('#form-filter')[0].reset();
  35.         table.ajax.reload();
  36.         $('#filterData').modal('hide');
  37.     });
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement