DataTables Custom Range Filtering

DataTables Custom Range Filtering

highflyinghighflying Posts: 9Questions: 5Answers: 0
edited April 2015 in Free community support

Hi all,

I'm in the process of using the custom range filter but I've run into a snag..

In the plug-in example (https://datatables.net/examples/plug-ins/range_filtering.html), the new table is drawn upon keyup and the min/max are extracted values. My table is drawn upon clicking the #applyfilter button and my values are passed in through variables. The first time I apply the filter, I get the expected result. The problem occurs when I change the values of min and max and the range gets bigger (smaller isn't the issue) . When I redraw the table (increasing the range), there's no change. Here's what I have so far:

function DataTableSearch(min, max, $colnum) {
    $.fn.dataTable.ext.search.push(
                    function (settings, data, dataIndex) {
                       var $fcolnum = parseFloat(data[$colnum].replace(/\s|-(\D)|[^-0-9]/g, "")) || 0;
                        if ((isNaN(min) && isNaN(max)) ||
                                (isNaN(min) && $fcolnum < max) ||
                                (min< $fcolnum && isNaN(max)) ||
                                (min< $fcolnum && $fcolnum < max)) {
                            return true;
                        }
                        return false;
                    }
                )
}


Any ideas what the issue may be? Thanks in advance.

This discussion has been closed.