Custom filtering - range seach not work
Custom filtering - range seach not work
Hello Dear
please help me.When I use this CODE:
/////////////////////////////////////////////////////////////////
var dt = $('#example').DataTable({
"processing": true,
"serverSide": true,
"ajax": "scripts/ids-objects.php",
"columns": [
{
"class": "details-control",
"orderable": false,
"data": null,
"defaultContent": ""
},
{ "data": "maskanID" },
{ "data": "PlaceMap" },
{ "data": "Position" },
{ "data": "TotalPrice" },
],
"order": [[1, 'asc']]
});
///////////////////////////////////////////////////////////////////
i dont use this code or not work this cod for Range Filtering :
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var min = parseInt( $('#minprice').val(), 10);
var max = parseInt( $('#maxprice').val(), 10);
var tprice = parseFloat(data[4])|| 0;
if ( ( isNaN( min ) && isNaN( max ) ) ||
( isNaN( min ) && tprice <= max )||
( min <= tprice && isNaN( max ) ) ||
( min <= tprice && tprice <= max ) )
{
return true;
}
return false;
}
);
////////////////////////////////////////////////////////////////////////////
and This Code:
$(document).ready(function() {
$('#minprice, #maxprice').keyup( function() {
dt.draw();
} );
} );
///////////////////////////////////////////////////////////////////////////////
and HTML Code:
<div style="float:left;margin:5px;padding:5px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>Min</td>
<td><input type="text" id="minprice" name="minprice" size="12"></td>
</tr>
<tr>
<td>Max</td>
<td><input type="text" id="maxprice" name="maxprice" size="12"></td>
</tr>
</table>
</div>
///////////////////////////////////////////////////////////////////////////////////////
PLEASE HELP ME:))))))))
thanks for all