To understand how to use this library and get full benefits of it, Follow the step by step process below
application/libraries/DataTables.php
file.DataTables.php
file from the package application/libraries
directoryapplication/libaries
directory.application/config/autoload.php
from your Codeigniter's Directory.$autoload['libraries'] = array(...)
and add DataTables
to the array.autoload.php
file.Company.php
in application/controllers/
directoryCompany.php
class Company extends CI_Controller{
public function employees_ajax(){
echo '{}';
}
public function employees(){
$this->load->view('employees');
}
public function departments_ajax(){
echo '{}';
}
public function departments(){
$this->load->view('departments');
}
}
application/views/
and create a file with name employees.php
Paste the following code into the employees.php
file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Employees</title>
<link href="https://github.com/SalFay/CodeIgniter-DataTables/blob/master/css/bootstrap.min.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<h1>Hello, world!</h1>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</body>
</html>