who create a searching columns rows before hide first column
who create a searching columns rows before hide first column
 jjcfidalgo@gmail.com            
            
                Posts: 11Questions: 8Answers: 0
jjcfidalgo@gmail.com            
            
                Posts: 11Questions: 8Answers: 0            
            I need hide and sorting the first column.
In columns 2,3,4 a need put a dropdownlist to shearch
Who do that
I try this but don't works
  var table = $('#grid').DataTable({
        //orderCellsTop: true,
       // responsive: true,
        fixedHeader: true,
        "scrollX": true,
        "order": [[0, "desc"]],
 // Hidden part
"columnDefs": [
    { "visible": false, "targets": 0 }
],
  
        initComplete: function() {
            this.api()
              .columns([1,2,3])
              .every( function () {
                var column = this;
                var select = $('<select class="custom-select custom-select-sm form-control form-control-sm"><option value=""></option></select>')
                  .appendTo( $("thead tr:eq(1) td").eq(column.index()).empty() )
                  .on( 'change', function () {
                    var val = $.fn.dataTable.util.escapeRegex(
                            $(this).val());
                    column
                        .search( val ? '^' + val + '$' : '', true, false ).draw();
                  });
    
                  column
                    .data()
                    .unique()
                   /// .sort()
                    .each( function ( d, j ) {
                      select.append( '<option value="' + d + '">' + d + '</option>' );
                  });
            });
          
        },
      
    });
Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide
This question has an accepted answers - jump to answer
This discussion has been closed.
            
Answers
I created a test case for you.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
http://live.datatables.net/yicoqafe/1/edit
There are a few issues.
.appendTo( $("thead tr:eq(1) td"). But the footer is usingthso the selector should be$("thead tr:eq(1) th").orderCellsTop, ie,orderCellsTop: true,.initCompleteexecutes. Instead of using{ "visible": false, "targets": 0 }hide the column ininitCompleteafter the select search lists are created.Kevin