I need Server-side processing in datatables

I need Server-side processing in datatables

Periyasamy25Periyasamy25 Posts: 13Questions: 0Answers: 0
edited March 2014 in General
I am using two dropdown for search.onchange of dropdown i am calling the ajax function to fetch the values from database based on dropdown values and displaying in table(datatable).So how to include side-side processing in my coding.

My Sample Coding is.

index.php:


val1
val2


val3
val4




$(".search").change(function()
{
var val1=$('#val1').val();
var val2=$('#val2').val();
$.ajax(
{
url: 'table.php',
type: "get",
data: "val1="+val1+"&val2="+val2,
success: function(resp)
{
$("#table").html(resp);
var oTable = $('#example').dataTable(
{
"bProcessing": true,
"bJQueryUI": true,
"bDeferRender": true,
"oLanguage": {
"sSearch": 'Search rows:',
"sLengthMenu": "Display _MENU_ rows",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ rows",
"sInfoEmpty": "Showing 0 to 0 of _TOTAL_ rows",
"sInfoFiltered": "(filtered from _MAX_ total rows)",
"sZeroRecords": "No rows available in table",
},
"aLengthMenu": [[10, 25, 50, 100, 200, 300], [10, 25, 50, 100, 200, 300]],
"sDom": 'lf rr pi rt pi',
});
}
});

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'd suggest you use fnServerParams to send the extra data to the server, rather that recreating the whole table on every input change, which is very inefficient.

    Allan
This discussion has been closed.