File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_dates.js

Recommend this page to a friend!
  Classes of Emmanuel Podvin   Blapy   demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_dates.js   Download  
File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_dates.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Blapy
jQuery plugin to load linked pages using AJAX
Author: By
Last change: Update of demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_dates.js
Date: 3 years ago
Size: 1,557 bytes
 

Contents

Class file image Download
/** * Filter a column on a specific date range. Note that you will likely need * to change the id's on the inputs and the columns in which the start and * end date exist. * * @name Date range filter * @summary Filter the table based on two dates in different columns * @author _guillimon_ * * @example * $(document).ready(function() { * var table = $('#example').DataTable(); * * // Add event listeners to the two range filtering inputs * $('#min').keyup( function() { table.draw(); } ); * $('#max').keyup( function() { table.draw(); } ); * } ); */ $.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { var iFini = document.getElementById('fini').value; var iFfin = document.getElementById('ffin').value; var iStartDateCol = 6; var iEndDateCol = 7; 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; } );