I have a filter to show column table based on user inputs. There are 4 checkboxes and user can choose if they want to see the DATE
, SENDER
, RECEIVER
, PHONE
, and ADDRESS
column. I dont know how to achieve this.
<div class="table-responsive">
<table align="center" class="table table-striped">
<thead align="center">
<tr class="head" align="center">
<th class="hidden-xs">No</th>
<th class="hidden-xs">Date</th>
<th id="sender">Sender</th>
<th>Receiver</th>
<th>Phone</th>
<th>Address</th>
</tr>
</thead>
<tbody>
<?php
foreach ($shipments as $row) {
?>
<tr>
<td class="hidden-xs">
<?php echo $no ?>
</td>
<td class="hidden-xs" nowrap="nowrap" id="column_date">
<?php echo date("d-m", strtotime($row['booking_date'])) ?>
</td>
<td>
<?php echo $row['from_name'] ?>
</td>
<td>
<?php echo $row['to_name'] ?>
</td>
<td>
<?php echo $row['to_phone'] ?>
</td>
<td>
<?php echo $row['to_address'] ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
the checkboxes:
<p>Show Fields</p>
<label>
<input type="checkbox" id="check_date" class="showfilter"> Date</label><br>
<label>
<input type="checkbox" id="check_sender" class="showfilter"> Sender</label><br>
<label>
<input type="checkbox" id="check_receiver" class="showfilter"> Receiver</label><br>
<label>
<input type="checkbox" id="check_phone" class="showfilter"> Phone</label><br>
<label>
<input type="checkbox" id="check_address" class="showfilter"> Address</label><br>
<label>
<button class="btn btn-primary">Show</button>
The data comes from Controller:
$this->load->model('booking_model');
$this->db->select('booking_date, from_name, to_name, to_phone, to_address, vendor_name, vendor_airway_bill, weight, volumetric_weight, tariff, booking_status_text, status');
$data['shipments'] = $this->booking_model->read_extended(array('from_email'=>$this->session->user_email,'status >'=>0));
Aucun commentaire:
Enregistrer un commentaire