Membuat filter datatabels pada codeigniter

saya mau bertanya kak bagaimana membuat filter datatabels ? saya sudah mencobanya tapi letak errornya. Message: Undefined variable: form_start Filename: kapal/data_kapal.php Line Number: 25

<section class="content-header">
      <h1>
        Data Kapal Landing Sampling
        <small>Enumerasi Daerah 2018</small>
      </h1>
    </section>
     <!-- Main content -->
    <section class="content">

    <section class="content">
      <div class="row">
        <div class="col-xs-12">
          <!-- /.box -->
          <div class="box">
            <div class="box-header">
            <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title" >Custom Filter : </h3>
            </div>
            <div class="panel-body">
                <form id="form-filter" class="form-horizontal">
                    <div class="form-group">
                        <label for="nama_kapal" class="col-sm-2 control-label">Nama Kapal</label>
                        <div class="col-sm-4">
                            <?php echo $form_start; ?>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="alat_tangkap" class="col-sm-2 control-label">Alat Tangkap</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="alat_tangkap">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="bulan" class="col-sm-2 control-label">Bulan</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="bulan">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="jenis_armada" class="col-sm-2 control-label">Jenis Armada</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" id="jenis_armada">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="alat_tangkap" class="col-sm-2 control-label"></label>
                        <div class="col-sm-4">
                            <button type="button" id="btn-filter" class="btn btn-primary">Filter</button>
                            <button type="button" id="btn-reset" class="btn btn-default">Reset</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
              <a href="<?php echo base_url('index.php/Data_kapal/tambah_kapal');?>" type="button" class="btn btn-primary"><i class="fa fa-plus-square-o"></i> Tambahkan Data Kapal</a>
              <a href="<?php echo base_url("index.php/export_kapal/export"); ?>" type="button" class="btn btn-success"><i class="fa fa-cloud-download"></i> Export ke Excel</a>
              <a href="<?php echo base_url("index.php/import_kapal/formkapal"); ?>" type="button" class="btn btn-warning"><i class="fa fa-cloud-upload"></i> Import </a>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped">
		                  <thead>
		                    <tr>
		                    	<th>No</th>
                    			<th>Id Sampel</th>
                     			<th>Tanggal</th>
                     			<th>Lokasi</th>
                     			<th>Hari</th>
                      		<th>Bulan</th>
                     			<th>Tahun</th>
                     			<th>Nama Kapal</th>
                     			<th>Jenis Armada</th>
                     			<!-- <th>Alat Tangkap</th>
                    			<th>Sampling</th>
                      		<th>Tidak Sampling</th> -->
                          <th>Action</th>
		                    </tr>
		                  </thead>
		                  <tbody>
		                    <?php
		                    	$no=1;
		                    	foreach ($kapal as $kpl) {
		                    ?>

		                      <tr>
		                      		  <th><?php echo $no++; ?></td>
		                            <td><?php echo $kpl['id_sampel']; ?></td>
                          			<td><?php echo $kpl['tanggal']; ?></td>
                          			<td><?php echo $kpl['lokasi']; ?></td>
                          			<td><?php echo $kpl['hari']; ?></td>
                          			<td><?php echo $kpl['bulan']; ?></td>
                          			<td><?php echo $kpl['tahun']; ?></td>
                          			<td><?php echo $kpl['nama_kapal']; ?></td>
                          			<td><?php echo $kpl['jenis_armada']; ?></td>
                          			<!-- <td><?php //echo $kpl['alat_tangkap']; ?></td>
                         			  <td><?php //echo $kpl['sampling']; ?></td>
                           			<td><?php //echo $kpl['tidak_sampling']; ?></td> -->

                                <td><center>
                                    <div class="hidden-sm hidden-xs action-buttons">

                                            <a class="btn btn-xs btn-primary" href="<?php echo base_url('index.php/Data_kapal/getdata_kapal/'.$kpl['id']);?>">
                                              <i class="ace-icon fa fa-edit bigger-130"></i>
                                            </a>
                                            <a class="btn btn-xs btn-danger" href="<?php echo base_url('index.php/Data_kapal/hapusdata_kapal/'.$kpl['id']);?>" onclick="return confirm('Anda yakin hapus ?')">
                                              <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                            </a>
                                            <a class="btn btn-xs btn-primary" href="<?php echo base_url('index.php/Data_kapal/getdetail_kapal/'.$kpl['id']);?>">
                                              <i class="ace-icon fa fa-search bigger-130"></i>
                                            </a>
                                    </div>
                               </center></td>
                            </tr>
		                    <?php

		                    }

                         ?>
                      </tbody>
                        <tfoot>
                        <tr>
                            <th>No</th>
                            <th>Id Sampel</th>
                            <th>Tanggal</th>
                            <th>Lokasi</th>
                            <th>Hari</th>
                            <th>Bulan</th>
                            <th>Tahun</th>
                            <th>Nama Kapal</th>
                            <th>Jenis Armada</th>
                            <!-- <th>Alat Tangkap</th>
                            <th>Sampling</th>
                            <th>Tidak Sampling</th> -->
                            <th>Acion</th>
                        </tr>
                        </tfoot>

		                  </tbody>
			              </table>
			            </div>
			            <!-- /.box-body -->
			          </div>
			          <!-- /.box -->
			        </div>
			        <!-- /.col -->
			      </div>
			      <!-- /.row -->
			    </section>
	</div>
</div>

</body>
</html>

mohon bantuannya kak . terimakasih sebelumnya:)

avatar yudhiariawan
@yudhiariawan

1 Kontribusi 0 Poin

Diperbarui 5 tahun yang lalu

2 Jawaban:

variable form_start nya ga ada, cek controllernya buat mastiin..

avatar ameliac
@ameliac

104 Kontribusi 27 Poin

Dipost 5 tahun yang lalu

Tanggapan

sudah saya buatkan variable di controllers kak.

public function index() { $this->load->helper('url'); $this->load->helper('form');

    $kapalfilter = $this-&gt;tbkapal_landing-&gt;get_list_kapalfilter();

    $opt = array(&#039;&#039; =&gt; &#039;All Nama Kapal&#039;);
    foreach ($kapalfilter as $nama_kapal) {
        $opt[$nama_kapal] = $nama_kapal;
    }

    $data[&#039;form_start&#039;] = form_dropdown(&#039;&#039;,$opt,&#039;&#039;,&#039;id=&quot;nama_kapal&quot; class=&quot;form-control&quot;&#039;);
    $this-&gt;load-&gt;view(&#039;kapal/data_kapal&#039;, $data);
}

mending pakai datatable aja gan lebih cepet dan praktis

avatar agungmuliawan
@agungmuliawan

1 Kontribusi 0 Poin

Dipost 5 tahun yang lalu

Login untuk ikut Jawaban