Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Controllernya :
- <?php
- public function showFormIndustri()
- {
- $get = $this->input->get();
- $output = array(
- 'data' => array(),
- 'sql' => array(),
- 'time' => array(),
- 'params' => $params,
- 'head' => array()
- );
- $output['draw'] = isset($get['draw']) ? $get['draw'] : rand(10000, 99999);
- $output['recordsTotal'] = $result['recordsFiltered'] = 0; //default
- $output['time']['start'] = microtime(); //wajib ada.. buat debug proses mana yg lambat
- $output['recordsTotal'] = $result['recordsFiltered'] = 999;//default
- $result = $this->auth_model->model_formindustri();
- $data = array();
- foreach ($result as $value) {
- $row = array();
- $row[] = $value->nama_industri;
- $row[] = $value->alamat_industri;
- $row[] = $value->telepon_industri;
- $row[] = $value->direktur_industri;
- $row[] = $value->periode;
- $row[] = $value->nomor_surat;
- $data[] = $row;
- }
- $output['data']=$data;
- $output['raw']=$result;
- echo json_encode($output);
- }
- ?>
- Viewnya :
- <label>Cek Data Industri</label>
- <table class="table table-bordered table-hover" id="tableFormPersetujuan">
- <thead>
- <tr>
- <th>Nama Industri</th>
- <th>Alamat Industri</th>
- <th>Telephon</th>
- <th>Direktur</th>
- <th>Nomor Surat</th>
- <th>Periode</th>
- </tr>
- </thead>
- </table>
- </div>
- </div>
- <!-- /.row -->
- </section>
- <!-- /.content -->
- </div>
- <script>
- $(function () {
- $('#tableFormPersetujuan').DataTable({
- "processing": true, //Feature control the processing indicator.
- "serverSide": true, //Feature control DataTables' server-side processing mode.
- "order": [], //Initial no order.
- 'ajax': {
- 'url' : '<?php echo site_url()?>index.php/admin/showFormIndustri'
- },
- "columnDefs": [
- {
- "targets": [ 0 ], //first column / numbering column
- "orderable": false, //set not orderable
- },
- ],
- });
- Modelnya :
- <?php
- public function model_formindustri()
- {
- $this->db->select(
- 'm_industri.nama_industri,
- m_industri.alamat_industri,
- m_industri.telepon_industri,
- m_industri.direktur,
- formulir_persetujuan.nomor_surat,
- formulir_persetujuan.periode');
- $this->db->from('formulir_persetujuan');
- $this->db->join('m_industri', 'm_industri.kode_industri = formulir_persetujuan.kode_industri');
- $query = $this->db->get();
- $result = $query->result_array();
- return $result;
- }
- ?>
Add Comment
Please, Sign In to add comment