PHP Classes

PHP Datatable AJAX JSON Server: Generate JSON data from database queries

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 71 This week: 4All time: 10,067 This week: 117Up
Version License PHP version Categories
datatable_server 1.0Custom (specified...5PHP 5, Databases, AJAX, Global
Description Author

This package can generate JSON data from database queries.

It provides a function that takes a configuration array and executes SQL queries on specific tables using the CodeIgniter framework.

The function returns a JSON string with the database query results suitable for being used by AJAX JavaScript code on the browser to display the query results without reloading the page.

Picture of Shabeer ALi M
  Performance   Level  
Name: Shabeer ALi M <contact>
Classes: 4 packages by
Country: India India
Innovation award
Innovation award
Nominee: 2x

Details

Datatable Server

Datatable server .

- Easy to use - Codeignator plug-in available.

Datatable server is php code that you can create json easily for [ajax datatable].

> The overriding design goal for Datatable Server PHP function is to create json easily with less configuration for datatable.

Version

1.0.1

Codeigniter Usage

Installation

You need to add [codeigniter/datatable_server_helper.php] in Codeigniter helpers folder: (yourproject/application/helpers/)

Usage

Call the function in your controller

//your custom function to call inside json render
function your_function($mobile){
    return $mobile;
}

$this->load->helper('datatable_server');
$config=array(
    // Coloums you need to select form database. [Array()]
    'aColumns' => array( 'id','name','email','mobile'),
	 
    //Index coloum of the table.	[String]
    'sIndexColumn' => 'id', 
	 
    // Table name 	[String]
 	// You can also gave join statement
 	// ex : 'sTable' =>"order left join invoice on invoiceid=orderid" ,
    'sTable' =>"address-book" , 	
	
    //If you have any conditional statement you can add like this. [String][optional]
    //'sCondition'=>'name like "%a"',	
		
	//Output needed in each coloum. [Array(Array('type'=>value))]
	// Usage
	// text	=>	Normal Text values
	// var =>  Variable Name.The variable name will replaced with the variable value.
	// The variable that you are selecting should be added in aColoums.
	// html =>  You can directly gave html. If you want to use variable in between you can use {{variable name}}.
	 // eval =>  You can call a function that you have written.You can use the arguments as your variable that you selected in aColoums.
     'aColumns_out' => array( 
         array('var'=>'id'),
         array('var'=>'name',
         array('html'=>'<a href="mailto:{{email}}">{{email}}</a>'),
         array('eval'=>'your_function($mobile)'),
        ),
     );	
echo dt_get_json($config);

License

MIT [codeigniter/datatable_server_helper.php]:https://github.com/shabeer-ali-m/datatable_server/blob/master/codeigniter/datatable_server_helper.php [ajax datatable]:http://www.datatables.net/examples/data_sources/server_side.html

  Files folder image Files  
File Role Description
Files folder imagecodeigniter (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  codeigniter  
File Role Description
  Accessible without login Plain text file datatable_server_helper.php Example Example script

 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:4
All time:10,067
This week:117Up