Skip to content
Customized Server Side Processing (SSP) Class For Datatables Library
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
example HAVING query support is added to ssp customizable class now Jul 22, 2017 Made header bolder via markdown Dec 6, 2017
ssp.php HAVING query support is added to ssp customizable class now Jul 22, 2017

Customized SSP Class For Datatables Library

SSP is a Server Side Processing class for Datatables Library v1.10.0. I have customized it for include JOIN, Extra condition and Rename acceptance within query.

While using Datatables with complex query, I faced problem like these

  • Get Data from Multiple table not supported via Joining.
  • Extra Where, except filtering was not possible.
  • During work on Multiple Table, to avoid Duplicate key was not possible.

So due to allow complex query, I have changed the SSP class like my own. What i made changes are

  • I have added option to ADD JOIN Query and make necessary changes.
  • I have changed Column ARRAY format to handle get data from multiple table. Add TWO new index for complex query handle.
  • Add Extra Where condition through SSP Class.
  • You can Group by the result via sending Query through simple function of SSP Class.
  • You can use Having as well same like Group By

New formatted COLUMN Array

$columns = array(
    array( 'db' => '`c`.`id`',       'dt' => 0, 'field' => 'id' ),
    array( 'db' => '`c`.`login`',    'dt' => 1  'field' => 'login' ),
    array( 'db' => '`c`.`password`', 'dt' => 2, 'field' => 'password' ),
    array( 'db' => '`c`.`name`',     'dt' => 3, 'field' => 'client_name', 'as' => 'client_name' ),
    array( 'db' => '`cn`.`name`',    'dt' => 4, 'field' => 'currency_name','as' => 'currency_name' )

    array( 'db' => '`c`.`id_client`', 'dt' => 5, 'formatter' => function( $d, $row ) {
                return '<a href="EDIT_URL"><span class="label label-inverse"><i class="fa fa-edit"></i> Edit</span></a>';},
            'field' => 'id_client' )

How to Use

$joinQuery = "FROM `{$table}` AS `c` LEFT JOIN `currency_names` AS `cn` ON (`cn`.`id` = `c`.`id_currency`)";
$extraCondition = "`id_client`=".$ID_CLIENT_VALUE;

echo json_encode(
       SSP::simple( $_GET, $sql_details, $table, $primaryKey, $columns, $joinQuery, $extraCondition)

I have described the changes at My personal blog. You can also check there to see details.

Hope it will help... Thanks

You can’t perform that action at this time.