Problem

Problem

pcmanpcman Posts: 2Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi ... a have a problem with range filtering and server-side.
I wanna make this with server-side, but it's not working.
http://datatables.net/examples/plug-ins/range_filtering.html

This is my code:
[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var iMin = document.getElementById('min').value * 1;
var iMax = document.getElementById('max').value * 1;
var iVersion = aData[0] == "-" ? 0 : aData[0]*1;
if ( iMin == "" && iMax == "" )
{
return true;
}
else if ( iMin == "" && iVersion <= iMax )
{
return true;
}
else if ( iMin <= iVersion && "" == iMax )
{
return true;
}
else if ( iMin < iVersion && iVersion < iMax )
{
return true;
}
return false;
}
);


$(document).ready(function() {

var oTable = $('#example').dataTable({
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "js/datatable/server_processing.php"
});

$('#min').keyup( function() { oTable.fnDraw(); } );
$('#max').keyup( function() { oTable.fnDraw(); } );

});
[/code]

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    In server-side processing all filtering is done on the server (hence "server-side processing" :-) ). So a Javascript filter won't be used. You'd need to add the range filtering to your php script.

    Allan
This discussion has been closed.