Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="content-wrapper">
- <section class="content">
- <div class="row">
- <div class="col-xs-12">
- <div class="box box-warning box-solid">
- <div class="box-header">
- <h3 class="box-title">KELOLA DATA DOKTER</h3>
- </div>
- <div class="box-body">
- <div style="padding-bottom: 10px;"'>
- <?php echo anchor(site_url('dokter/create'), '<i class="fa fa-wpforms" aria-hidden="true"></i> Tambah Data', 'class="btn btn-danger btn-sm"'); ?></div>
- <table class="table table-bordered table-striped" id="mytable">
- <thead>
- <tr>
- <th width="30px">No</th>
- <th>Nama Dokter</th>
- <th>Jenis Kelamin</th>
- <th>Id Status Menikah</th>
- <th>Id Spesialis</th>
- <th>Golongan Darah</th>
- <th width="200px">Action</th>
- </tr>
- </thead>
- <tfoot>
- <tr>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- </tfoot>
- </table>
- </div>
- </div>
- </div>
- </div>
- </section>
- </div>
- <script src="<?php echo base_url('assets/js/jquery-1.11.2.min.js') ?>"></script>
- <script src="<?php echo base_url('assets/datatables/jquery.dataTables.js') ?>"></script>
- <script src="<?php echo base_url('assets/datatables/dataTables.bootstrap.js') ?>"></script>
- <script type="text/javascript">
- $(document).ready(function() {
- $.fn.dataTableExt.oApi.fnPagingInfo = function(oSettings)
- {
- return {
- "iStart": oSettings._iDisplayStart,
- "iEnd": oSettings.fnDisplayEnd(),
- "iLength": oSettings._iDisplayLength,
- "iTotal": oSettings.fnRecordsTotal(),
- "iFilteredTotal": oSettings.fnRecordsDisplay(),
- "iPage": Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength),
- "iTotalPages": Math.ceil(oSettings.fnRecordsDisplay() / oSettings._iDisplayLength)
- };
- };
- var t = $("#mytable").dataTable({
- initComplete: function() {
- var api = this.api();
- /* $('#mytable_filter input')
- .off('.DT')
- .on('keyup.DT', function(e) {
- if (e.keyCode === 13) {
- api.search(this.value).draw();
- }
- }); */
- this.api().columns().every( function () {
- var column = this;
- var select = $('<select><option value=""></option></select>')
- .appendTo( $(column.footer()).empty() )
- .on( 'change', function () {
- var val = $.fn.dataTable.util.escapeRegex(
- $(this).val()
- );
- column
- .search( val ? '^'+val+'$' : '', true, false )
- .draw();
- } );
- column.data().unique().sort().each( function ( d, j ) {
- select.append( '<option value="'+d+'">'+d+'</option>' )
- } );
- } );
- },
- oLanguage: {
- sProcessing: "loading..."
- },
- processing: true,
- serverSide: true,
- ajax: {"url": "dokter/json", "type": "POST"},
- columns: [
- {
- "data": "kode_dokter",
- "orderable": false
- },{"data": "nama_dokter"},{"data": "jenis_kelamin"},{"data": "id_status_menikah"},{"data": "id_spesialis"},{"data": "golongan_darah"},
- {
- "data" : "action",
- "orderable": false,
- "className" : "text-center"
- }
- ],
- order: [[0, 'desc']],
- rowCallback: function(row, data, iDisplayIndex) {
- var info = this.fnPagingInfo();
- var page = info.iPage;
- var length = info.iLength;
- var index = page * length + (iDisplayIndex + 1);
- $('td:eq(0)', row).html(index);
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment