File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_numbers.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_numbers.js   Download  
File: demos/startbootstrap-sb-admin-2/bower_components/datatables-plugins/filtering/row-based/range_numbers.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_numbers.js
Date: 3 years ago
Size: 1,283 bytes
 

Contents

Class file image Download
/** * Filter a specific numeric column on the value being between two given * numbers. Note that you will likely need to change the id's on the inputs * and the column in which the numeric value is given. * * @summary Filter the data between two numbers (inclusive) * @name Range filtering (numbers) * @author [Allan Jardine](http://sprymedia.co.uk) * * @example * $(document).ready(function() { * // Initialise datatables * var table = $('#example').DataTable(); * * // Add event listeners to the two range filtering inputs * $('#min').keyup( function() { table.draw(); } ); * $('#max').keyup( function() { table.draw(); } ); * } ); */ jQuery.fn.dataTableExt.afnFiltering.push( function( oSettings, aData, iDataIndex ) { var iColumn = 3; var iMin = document.getElementById('min').value * 1; var iMax = document.getElementById('max').value * 1; var iVersion = aData[iColumn] == "-" ? 0 : aData[iColumn]*1; if ( iMin === "" && iMax === "" ) { return true; } else if ( iMin === "" && iVersion < iMax ) { return true; } else if ( iMin < iVersion && "" === iMax ) { return true; } else if ( iMin < iVersion && iVersion < iMax ) { return true; } return false; } );