0
votes

DataTables server-side processing

$(document).ready(function() {
    $('#example').dataTable( {
        "bProcessing": true,
        "bServerSide": true,
        "sAjaxSource": "scripts/server_processing.php"
    } );
} );

DataTables AJAX source

$(document).ready(function() {
    $('#example').dataTable( {
        "bProcessing": true,
        "sAjaxSource": '../ajax/sources/arrays.txt'
    } );
} );

only difference is "bServerSide":true

both behave same so what is difference between these two data sources

here is the example of both Data sources

http://datatables.net/release-datatables/examples/server_side/server_side.html

http://datatables.net/release-datatables/examples/data_sources/ajax.html

1

1 Answers

5
votes

both behave same

No they don't :-). With bServerSide: true all processing (sorting, filtering etc) is done on the server (typically by an SQL engine). Without bServerSide: true, then all processing is done on the client-side by DataTables.

The big advantage of using server-side processing is that you get to utilise the SQL engine for doing the heaving lifting, which is exactly what it was designed for, and thus the table can cope with virtually unlimited rows (limited only by the server). The disadvantage is that you need an Ajax request for each table draw.

Conversely with client-side side-processing all the data is local on the client, so there is no delay. However the processing of the data is done in Javascript and as tables get larger the amount of time to process data can become noticeably longer.

There is more information of the data source types for DataTables in the documentation: http://datatables.net/usage/#data_sources

Allan