SHARE
TWEET

Untitled

a guest Jan 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. $.fn.DataTable.ext.errMode = 'none';
  3.  
  4. $(document).ready (function () {
  5.    
  6.     var table=$('#dataGol').DataTable({
  7.         "processing": true,
  8.         "destroy": true,
  9.         "serverSide": false,//set false, karena untuk search. untuk searchable biar work di proses di client-side
  10.         "ajax": {
  11.             "url": "golongan/getData",
  12.             "type": "GET",
  13.              
  14.             "dataSrc": function (d) {
  15.          return d}
  16.         },
  17.         "columns": [
  18.             { "data": "Kd_golongan",searchable:true },
  19.             { "data": "Nama_Golongan",searchable:true },
  20.             { "data": "Keterangan"},
  21.             { "mRender":function (data,type,row){
  22.                     return '<button type="button" class="btn btn-warning btn-sm kucing"  '
  23.                       +' ">Edit</button>'+
  24.                       '<a href="#" id="hapus" onclick=test() class="btn btn-warning btn-sm"  '
  25.                       +' data-target="#modalEdit">Hapus</a>';
  26.  
  27.                 },searchable:false
  28.             }
  29.         ]
  30.     });
  31.    
  32.     $('#dataGol').on('click', '.kucing', function(e) {
  33.             $('#dataGol').on('click', '.kucing', function(e) {
  34.                 let currentRowIndex = $('e.target').closest('tr').index();
  35.         });
  36.     });
  37.  
  38.     $('#modalEdit').data('show.bs.modal', function(e) {
  39.        
  40.         console.log('#modalEdit').data('row-index');
  41.        
  42.     });
  43.  
  44. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top