Range Filtering Two Columns with Numbers

Range Filtering Two Columns with Numbers

rurede05rurede05 Posts: 2Questions: 0Answers: 0
edited December 2011 in Plug-ins
I have a simple problem that I can't seem to figure out. I am using the TableTools plugin and trying to do range filtering. I have two columns with a start number and a finish number ex. Start 100 / Finish 200 that are tied to company X.

I have a search box that in theory should query the database between those two ranges ex. someone types in 151 then the data displayed in the table would be that tied to company X since they have from range 100-200.

However, I also have the out-of-the-box search box that queries everything. I am wondering what I can do to fix what I have or what can I do to modify the out-of-the-box search since the one I added doesn't seem to work. I see it try to process when I punch in a number but nothing happens. When I query the out-of-the-box search it process fine.

Any help would be much appreciated.

[code]
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var ZipCode = $('#ZipCode').attr("value")
var ZipCodeStart = aData[0] ? aData[0] : "";
var ZipCodeFinish = aData[1] ? aData[1] : "";
if ( ZipCode == "" )
{
return false;
}
else if ( ZipCodeStart == "" || ZipCodeFinish == "" )
{
return true;
}
else if ( ZipCodeStart < ZipCode.substr(0,3) && ZipCode.substr(0,3) < ZipCodeFinish )
{
return true;
}
return false;
});
var oTable;
$(document).ready(function() {
oTable = $('#example').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "server_processing.php",
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"sDom": '<"H"Tfr>t<"F"ip>',
"oTableTools": {
"sSwfPath": "media/swf/copy_cvs_xls_pdf.swf",
"aButtons": [
"copy", "csv", "xls", "pdf",
{
"sExtends": "collection",
"sButtonText": "Save",
"aButtons": [ "csv", "xls", "pdf" ]

}
]
}
} );
$('#ZipCode').keyup( function() { oTable.fnDraw(); } );
} );

[/code]

Replies

This discussion has been closed.