Membuat datatable dengan sum di total di footer

Assalamualaikum gan, saya mau buat total untuk tiap data yang saya punya menggunakan data table, berikut ini source code saya html

              <table id="dashboard-nama-op" class="display" style="width:100%">
                <thead>
                  <th>No</th>
                  <th>Nama OP</th>
                  <th>Jumlah Kursus</th>
                  <th>Jumlah Video</th>
                  <th>Jumlah File</th>
                  <th>Jumlah Latihan</th>
                  <th>Jumlah Ujian</th>
                  <th>Jumlah User</th>
                  <th>Jumlah Peserta</th>
                </thead>
                <tbody>

                </tbody>
<!--                 <tfoot align="right">
                  <th rowspan="2">Total</th>
                  <th></th>
                </tfoot> -->
              </table>

datatable

     $('#dashboard-nama-op').DataTable( {
          ajax: '<?php echo base_url().'admin/master/organisasi/dashboard' ?>',
          columns: [
              {
                width: "2%" ,
                data: null, render: function ( data, type, row,meta ) {
                  return meta.row + meta.settings._iDisplayStart + 1;
              } },
              { data: "organisasi_nama", width: "30%"},

              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_kursus == ''){
                    var jumlah_kursus = 0
                  }
                  else {
                    var jumlah_kursus = data.jumlah_kursus
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_kursus;
                }
              },

              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_video == null){
                    var jumlah_video = 0
                  }
                  else {
                    var jumlah_video = data.jumlah_video
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_video;
                }
              },

              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_file == null){
                    var jumlah_file = 0
                  }
                  else {
                    var jumlah_file = data.jumlah_file
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_file;
                }
              },

              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_latihan == null){
                    var jumlah_latihan = 0
                  }
                  else {
                    var jumlah_latihan = data.jumlah_latihan
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_latihan;
                }
              },
              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_ujian == null){
                    var jumlah_ujian = 0
                  }
                  else {
                    var jumlah_ujian = data.jumlah_ujian
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_ujian;
                }
              },
              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_user == null){
                    var jumlah_user = 0
                  }
                  else {
                    var jumlah_user = data.jumlah_user
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_user;
                }
              },
              {
                 data: null, render: function ( data, type, row ) {
                  if(data.jumlah_peserta == null){
                    var jumlah_peserta = 0
                  }
                  else {
                    var jumlah_peserta = data.jumlah_peserta
                  }
                  // Combine the first and last names into a single table field
                  return jumlah_peserta;
                }
              }
          ]
      } );

sudah cari untuk sum belum ketemu". mohon bantuan nya master"

avatar rankoms
@rankoms

89 Kontribusi 12 Poin

Dipost 4 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban