Guest User

Untitled

a guest
Mar 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. ========== HTML =================
  2. <table id="example" class="display" cellspacing="0" width="100%">
  3. <thead>
  4. <tr>
  5. <th>Sr.</th>
  6. <th>Branch</th>
  7. </tr>
  8. </thead>
  9. </table>
  10.  
  11. [in footer]
  12. (document).ready(function() {
  13. $('#example').DataTable( {
  14. "ajax": '<?php echo base_url(); ?>Batch/batchtable'
  15. } );
  16.  
  17. ========== HTML =================
  18.  
  19. ========== Controller =================
  20. public function batchtable(){
  21.  
  22. $batchdata = $this->model->batchdetail();
  23.  
  24. $data=array();
  25. $x=1;
  26. foreach($batchdata as $batch_data) {
  27. $encrypted_id = $this->model->encryptdata($batch_data['batch_id']);
  28. $coursename=$batch_data['course'];
  29.  
  30. $data[] = array(
  31. $x,
  32. $batch_data['branch_name'],
  33. $batch_data['batch_name'],
  34. array_column($coursename, 'course_name'),
  35. $batch_data['startdate'],
  36. $batch_data['enddate'],
  37. $batch_data['maximum_student'],
  38. $batch_data['active'],
  39. "
  40. <a href='".base_url()."Batch/viewbatch/".$encrypted_id."' class='EditBtn btn green btn-sm'>
  41. <span class='glyphicon glyphicon-eye-open'></span>
  42. </a>
  43. <a href='".base_url()."Batch/editbatch/".$encrypted_id."' class='EditBtn btn green btn-sm'>
  44. <span class='glyphicon glyphicon-pencil'></span>
  45. </a>
  46. <a href='".base_url()."Batch/deletebatch/".$encrypted_id."' data-toggle='confirmation' id='deleteadd' data-placement='left' class='btn red btn-sm deleteconform'>
  47. <span class='glyphicon glyphicon-trash'></span>
  48. </a>"
  49. );
  50. $x++;
  51. }
  52. $output = array(
  53. "data" => $data
  54. );
  55. echo json_encode($output);
  56. exit();
  57. }
  58. ========== Controller =================
Add Comment
Please, Sign In to add comment