public function dataTable($cache) { /* * DataTables example server-side processing script. * * Please note that this script is intentionally extremely simply to show how * server-side processing can be implemented, and probably shouldn't be used as * the basis for a large complex system. It is suitable for simple use cases as * for learning. */ // DB table to use $table = self::TABLENAME; // Table's primary key $primaryKey = 'id'; // Array of database columns which should be read and sent back to DataTables. // The `db` parameter represents the column name in the database, while the `dt` // parameter represents the DataTables column identifier. In this case simple // indexes $columns = array(array('db' => 'id', 'dt' => 0, 'formatter' => function ($d, $row) { return "<input type='radio' value='{$d}' class='i-grey' name='id' checked>"; }), array('db' => 'name', 'dt' => 1), array('db' => 'status', 'dt' => 2, 'formatter' => function ($d, $row) { return self::getStringStatus($d); }), array('db' => 'address', 'dt' => 3), array('db' => 'phone', 'dt' => 4), array('db' => 'username', 'dt' => 5)); require 'DataTable.php'; echo json_encode(DataTable::simple($_POST, $table, $primaryKey, $columns, $cache)); }