problem column-filter and reopen...with visibility plugin

problem column-filter and reopen...with visibility plugin

grydangrydan Posts: 1Questions: 1Answers: 0
edited April 2016 in Free community support

Hello,
I have crated my datatables builder with this component:

"DataTables 1.10.10, Buttons 1.1.0, Column visibility 1.1.0, ColReorder 1.3.0, FixedColumns 3.2.0, FixedHeader 3.1.0, Responsive 2.0.0, Select 1.1.0"

I use Datatables with server-side feature.

I have created the column filter in this way


$(document).ready( function() {

$("#idDataTables thead tr:eq(1) th").each( function () {
        var title = $('#idDataTables  thead tr:eq(0) th').eq( $(this).index() ).text();
        //$(this).html( "<input type=\"text\" placeholder=\"search "+title+"\" />" );
        $(this).html( "<input type=\"text\" placeholder=\""+title+"\"/>" );
    } );    

});

and I have activate the browser localstore when back with this code:


 var state = table.state.loaded();
    if ( state ) {
      table.columns().eq( 0 ).each( function ( colIdx ) {
        var colSearch = state.columns[colIdx].search;
        
        if ( colSearch.search ) {
          $( 'input', 'thead tr:eq(1) th:eq(' + colIdx + ')' ).val( colSearch.search );
        }
      } );
      table.columns.adjust().draw();
      table.draw();
    }
    
   // Apply the search column filters
    // Apply the search
    table.columns().every(function (index) {
        $('thead tr:eq(1) th:eq(' + index + ') input').on('keyup change', function () {
            table.column($(this).parent().index() + ':visible')
                .search(this.value)
                .draw();
        });
    });

everything works perfectly except for one case

if I write in the third column, for example, in the inputbox filter... then hide using the appropriate plugin Column visibility the first column.
Change page and after re-open the same page ... the filter inputbox filled is the fifth column, and not the third.

Why?

Is a Bug?

This discussion has been closed.