jQuery Datatable Server Side Processing with codeigniter

jQuery Datatable Server Side Processing with codeigniter

jQuery Datatable Server Side Processing with codeigniter

In this Post We Will Explain About is jQuery Datatable Server Side Processing with codeigniter With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Data table Server Side Processing with codeigniter Example

In this post we will show you Best way to implement Datatable demo (Server side) in codeigniter,Mysql and Ajax, hear for DataTables – Development – server-side processing using codeigniter with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

  PHP cURL Basic CRUD Example

Controllers – crud.php

load->view('crud_view', $data);  
      }  
      function get_student(){  
           $this->load->model("ci_crud_model");  
           $getStud_data = $this->ci_crud_model->make_datatables();  
           $data = array();  
           foreach($getStud_data as $data_row)  
           {  
                $stud_arr = array();  
                $stud_arr[] = '<img>image.'" class="img-thumbnail" width="100" height="30" />';  
                $stud_arr[] = $data_row->student_fname;  
                $stud_arr[] = $data_row->student_lname;  
                $stud_arr[] = '<button type="button" name="update">id.'" class="btn btn-warning btn-xs">Update</button>';  
                $stud_arr[] = '<button type="button" name="delete">id.'" class="btn btn-danger btn-xs">Delete</button>';  
                $data[] = $stud_arr;  
           }  
           $output = array(  
                "draw"                    =>     intval($_POST["draw"]),  
                "recordsTotal"          =>      $this->ci_crud_model->get_student_list(),  
                "recordsFiltered"     =>     $this->ci_crud_model->get_stud_filterData(),  
                "data"                    =>     $data  
           );  
           echo json_encode($output);  
      }  
 }  

Models – ci_crud_model.php

 db->select($this->select_column);  
           $this->db->from($this->table);  
           if(isset($_POST["search"]["value"]))  
           {  
                $this->db->like("student_fname", $_POST["search"]["value"]);  
                $this->db->or_like("student_lname", $_POST["search"]["value"]);  
           }  
           if(isset($_POST["order"]))  
           {  
                $this->db->order_by($this->order_column[$_POST['order']['0']['column']], $_POST['order']['0']['dir']);  
           }  
           else  
           {  
                $this->db->order_by('id', 'DESC');  
           }  
      }  
      function make_datatables(){  
           $this->student_query();  
           if($_POST["length"] != -1)  
           {  
                $this->db->limit($_POST['length'], $_POST['start']);  
           }  
           $get_query = $this->db->get();  
           return $get_query->result();  
      }  
      function get_stud_filterData(){  
           $this->student_query();  
           $get_query = $this->db->get();  
           return $get_query->num_data_rows();  
      }       
      function get_student_list()  
      {  
           $this->db->select("*");  
           $this->db->from($this->table);  
           return $this->db->count_all_results();  
      }  
 }  

Include External Script

<!-- Devloped by Pakainfo.com free download examples -->  
  
  
<!-- Devloped by Pakainfo.com free download examples -->
            
<!-- Devloped by Pakainfo.com free download examples -->
  

Views – crud_view.php

  
   
   <title> Pakainfo.com</title>   
   
   
 <!-- Devloped by Pakainfo.com free download examples -->
      <div class="container box">  
           <h3 align="center"></h3><br />  
           <div class="table-responsive">  
                <hr />  
                <table id="student_data" class="table">  
                     <thead>  
                          <tr>  
                               <th width="20%">Student Image</th>  
                               <th width="20%">Student First Name</th>  
                               <th width="20%">Student Last Name</th>  
                               <th width="15%">Student Edit</th>  
                               <th width="20%">Student Delete</th>  
                          </tr>  
                     </thead>  
                </table>  
           </div>  
      </div>  
   
   
 

script.js

 $(document).ready(function(){  
      var dataTable = $('#student_data').DataTable({  
           "processing":true,  
           "serverSide":true,  
           "order":[],  
           "ajax":{  
                url:"",  
                type:"POST"  
           },  
           "columnDefs":[  
                {  
                     "targets":[0, 3, 4],  
                     "orderable":false,  
                },  
           ],  
      });  
 });  

style.css

body  
{  
	margin:0;  
	padding:0;  
	background-color:#3a3d3b;  
}  
.box  
{  
	width:850px;  
	padding:30px;  
	background-color:#3d3d3d;  
	border:1px solid #4d4ds4;  
	border-radius:8px;  
	margin-top:12px;  
}  

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

  Multiple Image Upload using PHP into MYSQL database

Example

I hope you have Got What is Server-side DataTables in Codeigniter using jQuery And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Leave a Reply

avatar
  Subscribe  
Notify of