<!-- DataTables -->
<link rel="stylesheet" href="../themes/plugins/datatables/dataTables.bootstrap.css">
<!-- DataTables -->
<script src="../themes/plugins/datatables/jquery.dataTables.min.js"></script>
<script src="../themes/plugins/datatables/dataTables.bootstrap.min.js"></script>
<section class="content">
<div class="row">
<!-- left column -->
<div class="col-md-12">
<div class="box">
<div class="box-header">
</div><!-- /.box-header -->
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Country Name</th>
<th>Action</th>
</tr>
</thead>
<tbody id="location">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!--/.col (left) -->
</div> <!-- /.row -->
<script>
$(function () {
$("#example1").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
});
</script>
<script>
$(document).ready(function(){
var item = <?php echo $resultData; ?>;
var trHTML = '';
for (var key=0, size=item.length; key<size; key++){
trHTML += '<tr><td>' +item[key].cName+'</td><td>'+addAction(item[key].cId,item[key].cActive)+'</td></td></tr>';
}
$('#location').append(trHTML);
});
</script>
Controller
$data['resultData'] = json_encode($resultData);
Models
public function getAllDetails(){
$result = '';
$this->db->select('countryId as cId,countryName as cName,countryActive as cActive')->from('country');
$query = $this->db->get();
// echo $this->db->last_query();
// die();
if($query->num_rows() > 0){
$result = $query->result();
return $result;
}
return $result;
}
No comments:
Post a Comment