ColumnFilter, Buttons ColVis, StateSave in unison

ColumnFilter, Buttons ColVis, StateSave in unison

ar90ar90 Posts: 2Questions: 2Answers: 0
edited April 2016 in Free community support

Answer

After a bit more digging this morning I was able to find a resolution that works. In the latest available version of the Datatables Column Filter plugin you need to invert the return of the _fnColumnIndex around line 90.

this:

function _fnColumnIndex(iColumnIndex) {
            if (properties.bUseColVis)
                return iColumnIndex;
            else
                return oTable.fnSettings().oApi._fnVisibleToColumnIndex(oTable.fnSettings(), iColumnIndex);
        }

becomes this:

function _fnColumnIndex(iColumnIndex) {
            if (properties.bUseColVis)
                return oTable.fnSettings().oApi._fnVisibleToColumnIndex(oTable.fnSettings(), iColumnIndex);
            else
                return iColumnIndex;
        }

found in discussion thread here.

Edit 1

I was able to implement the solution given by dblu in the second discussion link for the text filters. I was unable to get bea's solution to work for select filters, however, which is what I'm actually using. It seems his solution MAY work, but the select filters indexes are off when the inputs are created, so even if his solution works the values displayed inside the selects are off.

Im working on a project and have each of the respective plugins working together almost 95%. The issue I'm having is if I hide a column or two, then refresh the page, the column filters index is off and I get incorrect filters for columns. This issue has been discussed:

here

and

here

but at this point both discussions are closed and I've been unable to implement any solutions they provided, and was looking to see if anyone has any suggestions or updated solutions?

I thought the 2nd solution may have been it but unfortunately my issue persists. Could it have something to do with that solution being for the ColVis extension which is now retired in favor of the Buttons extension? Would it be recommended to utilize the ColVis extension as opposed to the Buttons extension if that is the case?

My project is an Angular project so I'm using it in the context of angular-datatables, but it seems it all functions the same regardless, as everything else works fine.

Files and versions:

jQuery 2.2.3
Datatables 1.10.11
ColumnFilter 1.5.6
DatatablesButtons 1.1.2

This discussion has been closed.