$.fn.dataTableExt.afnFiltering.push - What is this?
$.fn.dataTableExt.afnFiltering.push - What is this?
Hello,
I'm trying to Impliment a filter by date range using the filtering plug-in (in the examples page on the website by: guillimon)
However i want this to be updated after button press now as far as i'm away $.fndataTableExt blah blah is a call to something inside dataTables correct?
I've tried replacing this with $('#mybutton').click and everything behond this is left the same but nothing is returned? not even an alert box which is what comes right after the function here's my code i'm using (Date value i'm trying to filter is the 5th Col along (so it would be 5 as programming counting starts from 0 any pointers as to where i'm going wrong?
[code] $(document).ready(function() {
$('#Details').dataTable({
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "full_numbers"
});
$('#mybutton').click(
function( oSettings, aData, iDataIndex ) {
alert("HI");
var iFini = document.getElementById('from_date').value;
var iFfin = document.getElementById('to_date').value;
var iStartDateCol = 3;
var iEndDateCol = 5;
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;
}
);
} );[/code]
I'm trying to Impliment a filter by date range using the filtering plug-in (in the examples page on the website by: guillimon)
However i want this to be updated after button press now as far as i'm away $.fndataTableExt blah blah is a call to something inside dataTables correct?
I've tried replacing this with $('#mybutton').click and everything behond this is left the same but nothing is returned? not even an alert box which is what comes right after the function here's my code i'm using (Date value i'm trying to filter is the 5th Col along (so it would be 5 as programming counting starts from 0 any pointers as to where i'm going wrong?
[code] $(document).ready(function() {
$('#Details').dataTable({
"aaSorting": [[ 0, "desc" ]],
"sPaginationType": "full_numbers"
});
$('#mybutton').click(
function( oSettings, aData, iDataIndex ) {
alert("HI");
var iFini = document.getElementById('from_date').value;
var iFfin = document.getElementById('to_date').value;
var iStartDateCol = 3;
var iEndDateCol = 5;
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;
}
);
} );[/code]
This discussion has been closed.
Replies
If you want to have a table take into account new filtering information which is available to your plug-in filter, just call fnDraw and DataTables will do a full redraw, refiltering the table.
Allan
1) Get the values from the two divs (that works fine) then
2) Filter DataTables based on these dates
Allan