From c586a329d62d4d6608699e5403653e0176b2a0f4 Mon Sep 17 00:00:00 2001 From: Mottie Date: Thu, 1 May 2014 11:33:27 -0500 Subject: [PATCH] Filter: operator filter searching now properly uses the parser --- js/jquery.tablesorter.widgets.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/jquery.tablesorter.widgets.js b/js/jquery.tablesorter.widgets.js index 205ae633..cdc5621f 100644 --- a/js/jquery.tablesorter.widgets.js +++ b/js/jquery.tablesorter.widgets.js @@ -438,16 +438,18 @@ ts.filter = { query = ts.formatFloat( iFilter.replace(ts.filter.regex.operators, ''), table ), parser = c.parsers[index], savedSearch = query; - // parse filter value in case we're comparing numbers (dates) + // parse filter value in case we're comparing numbers (dates) if (parsed[index] || parser.type === 'numeric') { - cachedValue = parser.format( '' + iFilter.replace(ts.filter.regex.operators, ''), table, c.$headers.eq(index), index ); - query = ( typeof query === "number" && cachedValue !== '' && !isNaN(cachedValue) ) ? cachedValue : query; + result = parser.format( $.trim('' + iFilter.replace(ts.filter.regex.operators, '')), table, [], index ); + query = ( typeof result === "number" && result !== '' && !isNaN(result) ) ? result : query; } + // iExact may be numeric - see issue #149; // check if cached is defined, because sometimes j goes out of range? (numeric columns) - cachedValue = ( parsed[index] || parser.type === 'numeric' ) && !isNaN(query) && cached ? cached : + cachedValue = ( parsed[index] || parser.type === 'numeric' )&& !isNaN(query) && typeof cached !== 'undefined' ? cached : isNaN(iExact) ? ts.formatFloat( iExact.replace(ts.filter.regex.nondigit, ''), table) : ts.formatFloat( iExact, table ); + if ( />/.test(iFilter) ) { result = />=/.test(iFilter) ? cachedValue >= query : cachedValue > query; } if ( /