Apply more than one range filter

Apply more than one range filter

noslannoslan Posts: 29Questions: 0Answers: 0
edited February 2014 in DataTables 1.9
Actually I'm using this function to generate a range filter in datatables:
[code]
function CreaFiltro(min,max,col){

var oTable = $('#example').dataTable();
$.fn.dataTableExt.afnFiltering.push(
function(oSettings, aData, iDataIndex) {
var engineColumn = parseInt(aData[col]);
if (engineColumn >= min && engineColumn <= max)
return true;
return false;
})

oTable.fnDraw();
$.fn.dataTableExt.afnFiltering.pop();

}
[/code]

It works fine, but I need to apply a second range filter using a function, is it possible? any suggestion?
Thanks!

Replies

  • allanallan Posts: 63,679Questions: 1Answers: 10,498 Site admin
    Absolutely possible. Rather than testing for the true condition, test for the false condition (i.e. invert the logic) and then, rather than returning true immediately, perform the second check.

    Allan
  • noslannoslan Posts: 29Questions: 0Answers: 0
    Thanks again Allan :)
This discussion has been closed.