Numeric range search min max from 2 columns
Numeric range search min max from 2 columns
gavinj2006
Posts: 6Questions: 3Answers: 0
Hi
I have 2 colums in my table, min_amount and max_amount
I have a textbox where I will enter a number and want to return any items where that value falls within min_amount and max_amount
I have added a custom search function but for the life cannot work out how I say "this number is between min_amount and maxamount
This is the code I have so far
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
var max = parseInt($('#belopp').val(), 10);
var amountmax = parseFloat(data[10]) || 0; // use data for the age column
var amountmin = parseFloat(data[9]) || 0; // use data for the age column
if (
(amountmax >= max )) {
return true;
}
return false;
});
});
Any pointers gratefully received
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @gavinj2006 ,
This example here should do the trick for you!
Hope that helps,
Cheers,
Colin
Thanks Colin, really helped me out,