Pagination with Server-side processing

Pagination with Server-side processing

dhyaneshdhyanesh Posts: 30Questions: 8Answers: 0

Hello,

I am a newbie trying to use Datatables with Bootstrap. I have a table that has about 4000 records and I am trying to display these records in a table. I have tried to add server-side processing to the PHP page but the results are displayed which are not paginated and the search box at the top of the table is disappearing.

My php script that is accessed through the web browser contains below:

$(document).ready(function() { $('tbl_test').dataTable( { processing: true, serverSide: true, ajax: '/scripts/server_processing_test.php' }); });

server_processing_test.php contains below:
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Easy set variables
*/

// DB table to use
$table = 'tbl_test';

// Table's primary key
$primaryKey = 'TestID';

// 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' => 'TestID', 'dt' => 0 ),
array( 'db' => 'TestCarrier', 'dt' => 1 ),
array( 'db' => 'EmailAdd', 'dt' => 9 ),
);

// SQL server connection information
$sql_details = array(
'user' => 'test_db',
'pass' => 'xxxxxxxxxxx',
'db' => 'test_test',
'host' => 'localhost'
);

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If you just want to use the basic configuration for DataTables with PHP
* server-side, there is no need to edit below this line.
*/

require( 'ssp.class.php' );

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

Please let me know what am I missing to make this work.

Thank you for your help

Dhyanesh

This discussion has been closed.