1. Go to this page and download the library: Download nineinchnick/edatatables library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nineinchnick / edatatables example snippets
'import' => array(
...
'ext.edatatables.*', //if it's in your extensions folder
'vendor.nineinchnick.edatatables.*', //if you're using composer (and have a 'vendor' alias!)
...
)
$criteria = new CDbCriteria;
// bro-tip: $_REQUEST is like $_GET and $_POST combined
if (isset($_REQUEST['sSearch']) && isset($_REQUEST['sSearch']{0})) {
// use operator ILIKE if using PostgreSQL to get case insensitive search
$criteria->addSearchCondition('textColumn', $_REQUEST['sSearch'], true, 'AND', 'ILIKE');
}
$sort = new EDTSort('ModelClass', $sortableColumnNamesArray);
$sort->defaultOrder = 'id';
$pagination = new EDTPagination();
$dataProvider = new CActiveDataProvider('ModelClass', array(
'criteria' => $criteria,
'pagination' => $pagination,
'sort' => $sort,
))