Range filtering with (dates)

Range filtering with (dates)

katrukhinkatrukhin Posts: 2Questions: 0Answers: 0
edited June 2010 in Plug-ins
Hello! Pls help with range filtering for dates.
I copy code to my web page, but this technique dont work...

My code page:
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">





DataTables example

@import "../../media/css/demo_page.css";
@import "../../media/css/demo_table.css";




/* Custom filtering function which will filter data in column four between two values */
$.fn.dataTableExt.afnFiltering.push(
function( oSettings, aData, iDataIndex ) {
var iFini = document.getElementById('fini').value;
var iFfin = document.getElementById('ffin').value;
var iStartDateCol = 4;
var iEndDateCol = 4;

iFini=iFini.substring(6,10) + iFini.substring(3,5)+ iFini.substring(0,2)
iFfin=iFfin.substring(6,10) + iFfin.substring(3,5)+ iFfin.substring(0,2)

var datofini=aData[iStartDateCol].substring(6,10) + aData[iStartDateCol].substring(3,5)+ aData[iStartDateCol].substring(0,2);
var datoffin=aData[iEndDateCol].substring(6,10) + aData[iEndDateCol].substring(3,5)+ aData[iEndDateCol].substring(0,2);

if ( iFini == "" && iFfin == "" )
{
return true;
}
else if ( iFini <= datofini && iFfin == "")
{
return true;
}
else if ( iFfin >= datoffin && iFini == "")
{
return true;
}
else if (iFini <= datofini && iFfin >= datoffin)
{
return true;
}
return false;
}
);
$(document).ready(function() {
/* Initialise datatables */
var oTable = $('#example').dataTable();

/* Add event listeners to the two range filtering inputs */
$('#fini').keyup( function() { oTable.fnDraw(); } );
$('#ffin').keyup( function() { oTable.fnDraw(); } );
} );



Data : from to





Rendering engine
Browser
Platform(s)
Data
CSS grade




Trident
Internet
Explorer 4/0
Win 95+
10/02/2010
X


Gecko
Mozilla 1/1
Win 95+ / OSX/1+
12/02/2010
A


Gecko
Mozilla 1/2
Win 95+ / OSX/1+
12/02/2010
A


Gecko
Mozilla 1/3
Win 95+ / OSX/1+
15/03/2010
A


Gecko
Seamonkey 1/1
Win 98+ / OSX/2+
07/06/2011
A




Rendering engine
Browser
Platform(s)
Engine version
CSS grade






DataTables © Allan Jardine 2008-2009.





[/code]
This discussion has been closed.