Skip to content
/ ssp Public
forked from bev-ru/ssp

Customized Server Side Processing (SSP) Class For Datatables Library

Notifications You must be signed in to change notification settings

vetash/ssp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 

Repository files navigation

##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.

New formatted COLUMN Array

$columns = array(
    array( 'db' => '`c`.`id`',       'dt' => 0),
    array( 'db' => '`c`.`login`',    'dt' => 1),
    array( 'db' => '`c`.`password`', 'dt' => 2),
    array( 'db' => '`c`.`name`',     'dt' => 3, 'as' => 'client_name'),
    array( 'db' => '`cn`.`name`',    'dt' => 4, 'as' => 'currency_name'),
    array( 'db' => '`c`.`id_client`', 'dt' => 5,
        'formatter' => function( $id, $row ) {
            return '<a href="EDIT_URL"><span class="label label-inverse"><i class="fa fa-edit"></i> Edit</span></a>';
        })
);

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

About

Customized Server Side Processing (SSP) Class For Datatables Library

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • CSS 48.4%
  • PHP 26.9%
  • HTML 18.1%
  • JavaScript 6.6%