Min/Max filter logic
Min/Max filter logic
pr0c3ss
Posts: 2Questions: 1Answers: 0
I'm using a filter fine - but have added an option where values that fall outside of the min/max are shown. For example..
If the logic of finding values between a min max range =
var min = parseInt( $('#min').val(), 10 );
var max = parseInt( $('#max').val(), 10 );
var page = parseFloat( data[11] ) || 0;
if ($("#in-range").is(':checked')){
if ( ( isNaN( min ) && isNaN( max ) ) ||
( isNaN( min ) && page <= max ) ||
( min <= page && isNaN( max ) ) ||
( min <= page && page <= max ) )
{
return true;
}
... what's the logic for displaying values that fall outside of given min/max ranges?
for ex. Table holds data 1-9.
Min range = 3
max range = 7
the return should be 1,2,3,7,8,9
help much appreciated
This discussion has been closed.
Answers
With a custom filter you want to return
false
if the row should be filtered out andtrue
if it should be shown in the results. So it sounds like you want to invert the logic used in the if statement.Allan
Hi I reversed the logic and tried returning true and false, but the results I get are not what's desired. I get no results
I'd be happy to write the code up for you under the DataTables support options.
Allan