Postingan lainnya
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:)
0
2 Jawaban:
variable form_start nya ga ada, cek controllernya buat mastiin..
0
Tanggapan
sudah saya buatkan variable di controllers kak.
public function index() { $this->load->helper('url'); $this->load->helper('form');
$kapalfilter = $this->tbkapal_landing->get_list_kapalfilter();
$opt = array('' => 'All Nama Kapal');
foreach ($kapalfilter as $nama_kapal) {
$opt[$nama_kapal] = $nama_kapal;
}
$data['form_start'] = form_dropdown('',$opt,'','id="nama_kapal" class="form-control"');
$this->load->view('kapal/data_kapal', $data);
}
mending pakai datatable aja gan lebih cepet dan praktis
0