Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ========== HTML =================
- <table id="example" class="display" cellspacing="0" width="100%">
- <thead>
- <tr>
- <th>Sr.</th>
- <th>Branch</th>
- </tr>
- </thead>
- </table>
- [in footer]
- (document).ready(function() {
- $('#example').DataTable( {
- "ajax": '<?php echo base_url(); ?>Batch/batchtable'
- } );
- ========== HTML =================
- ========== Controller =================
- public function batchtable(){
- $batchdata = $this->model->batchdetail();
- $data=array();
- $x=1;
- foreach($batchdata as $batch_data) {
- $encrypted_id = $this->model->encryptdata($batch_data['batch_id']);
- $coursename=$batch_data['course'];
- $data[] = array(
- $x,
- $batch_data['branch_name'],
- $batch_data['batch_name'],
- array_column($coursename, 'course_name'),
- $batch_data['startdate'],
- $batch_data['enddate'],
- $batch_data['maximum_student'],
- $batch_data['active'],
- "
- <a href='".base_url()."Batch/viewbatch/".$encrypted_id."' class='EditBtn btn green btn-sm'>
- <span class='glyphicon glyphicon-eye-open'></span>
- </a>
- <a href='".base_url()."Batch/editbatch/".$encrypted_id."' class='EditBtn btn green btn-sm'>
- <span class='glyphicon glyphicon-pencil'></span>
- </a>
- <a href='".base_url()."Batch/deletebatch/".$encrypted_id."' data-toggle='confirmation' id='deleteadd' data-placement='left' class='btn red btn-sm deleteconform'>
- <span class='glyphicon glyphicon-trash'></span>
- </a>"
- );
- $x++;
- }
- $output = array(
- "data" => $data
- );
- echo json_encode($output);
- exit();
- }
- ========== Controller =================
Add Comment
Please, Sign In to add comment