Solved (I think): ColumnFilter with ColReorder and ColVis for range inputs

Solved (I think): ColumnFilter with ColReorder and ColVis for range inputs

EitreEitre Posts: 5Questions: 0Answers: 0
edited July 2015 in Free community support

So continuing on this discussion: https://www.datatables.net/forums/discussion/12868/columnfilter-with-colreorder-and-colvis-fix-for-hidden-columns-null-columnfilter-colreorder

I found that this fix didn't solve the bug for range inputs.

So after trying some stuff I came up with this fix and thought I should share it with you.

At around line 232:

            $('#' + sFromId + ',#' + sToId, th).keyup(function () {

                var iMin = document.getElementById(sFromId).value * 1;
                var iMax = document.getElementById(sToId).value * 1;

Here I added this:

        $('#' + sFromId + ',#' + sToId, th).keyup(function () {
            myRangeFilterIndex = oTable.oApi._fnVisibleToColumnIndex(oTable.fnSettings(), $(this).parent().parent().index() );
            var iMin = document.getElementById(sFromId).value * 1;
            var iMax = document.getElementById(sToId).value * 1;

And then changed this at around line 212:

var iValue = aData[_fnColumnIndex(index)] == "-" ? 0 : aData[_fnColumnIndex(index)] * 1;

To:

var iValue = aData[myRangeFilterIndex] == "-" ? 0 : aData[myRangeFilterIndex] * 1;

I haven't tested it to much yet but it seems to work for me at least.

Replies

This discussion has been closed.