Min/max logic

I’m using datatable() plugin to filter table data. Below checks within a min and max range fine, so with table data
1,2,3,4,5,6,7,8,9

…and a min value of 3 and max of 5 entered, the return will be 3,4,5… this works good and logic is below

var min = parseInt( $('#min').val(), 10 );
var max = parseInt( $('#max').val(), 10 );     
var page = parseFloat( data[11] ) || 0;

if ($("#in-range").is(':checked')){
	console.log('inrange active');
    if ( ( isNaN( min ) && isNaN( max ) ) ||
         ( isNaN( min ) && page <= max ) ||
         ( min <= page   && isNaN( max ) ) ||
         ( min <= page   && page <= max ) )
    {
        return true;
    }

However, I’ve added a check out side of range option that should display results that fall not within the entered min & max. I can get it to display out of minimum value if the value is above entered minimum, but cannot get it to display below the minimum. Likewise for max - below max will display whereas above max doesnt display.

with the same table data values of 1-10. If minimum 4 and maximum 6 values are entered, The return should be 1,2,3,7,8,9

below code finds below min and above max but not above min and below max

var min = parseInt( $('#min').val(), 10 );
var max = parseInt( $('#max').val(), 10 );     
var page = parseFloat( data[11] ) || 0;

if ( ( isNaN( min ) && isNaN( max ) ) ||
         ( isNaN( max) && page < min ) ||
		 
         ( max < page   && isNaN( min ) ) ||
         ( max < page   && page < min ) )
    {

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.