Customaized SSP DataTables example Server-side processing

Handle Complex query like join or extra condition not supported at Datatables provided SSP class. After a lots of searching in google and forums not found any reliable solution. After that I changed the class as my own.

I have changed the SSP class like my own. The changes i made 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. And add TWO new index(‘field’, ‘as’) for complex query handle.
  • Read data from Multiple table via JOIN.
  • Add Extra Where condition through SSP Class.
  • You can Group by the result via sending Query through simple function of SSP Class.

You can see details at My Personal Blog Emran Ul Hadi's Persoanal Blog

This example shows a very simple joining between two tables and one extra condition added at Query.

First name Last name Position Office Email Phone Start date Salary
First name Last name Position Office Email Phone Start date Salary

The Javascript shown below is used to initialise the table shown in this example:

$(document).ready(function() { $('#example').dataTable( { "processing": true, "serverSide": true, "ajax": "scripts/server_processing.php" } ); } );

In addition to the above code, the following Javascript library files are loaded for use in this example:

The HTML shown below is the raw HTML table element, before it has been enhanced by DataTables:

This example uses a little bit of additional CSS beyond what is loaded from the library files (below), in order to correctly display the table. The additional CSS used is shown below:

The following CSS library files are loaded for use in this example to provide the styling of the table:

This table loads data by Ajax. The latest data that has been loaded is shown below. This data will update automatically as any additional data is loaded.

The script used to perform the server-side processing for this table is shown below. Please note that this is just an example script using PHP. Server-side processing scripts can be written in any language, using the protocol described in the DataTables documentation.

-- -- Table structure for table `user` -- CREATE TABLE `user` ( `id` int(10) NOT NULL auto_increment, `first_name` varchar(250) NOT NULL default '', `last_name` varchar(250) NOT NULL default '', `position` varchar(250) NOT NULL default '', `office` varchar(250) NOT NULL default '', `start_date` timestamp DEFAULT CURRENT_TIMESTAMP, `age` int(8), `salary` int(8), `extn` int(8), PRIMARY KEY (`id`) ); -- -- Table structure for table `user_details` -- CREATE TABLE IF NOT EXISTS `user_details` ( `user_id` int(10) NOT NULL, `email` varchar(50) NOT NULL, `phone` varchar(30) NOT NULL, KEY `user_id` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1;

The MySQL Table and dummy data sql you will get in this link: