Individual column searching (select inputs)

Individual column searching (select inputs)

bigwellybigwelly Posts: 1Questions: 1Answers: 0
edited February 2016 in Free community support

I am trying the example: https://datatables.net/examples/api/multi_filter_select.html
Individual column searching (select inputs)

on mine:

 $(document).ready(function() {
      $('#example').DataTable( {
      "sScrollX": "100%",
      "sScrollXInner": "100%",
      "bScrollCollapse": true,
      "sPaginationType": "full_numbers",
           initComplete: function () {
        this.api().columns().every( function () {
             var column = this;
             var select = $('<select><option value=""></option></select>')
                            .appendTo( $(column.footer()).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>' )
                                } );
                            } );
        $('#example tfoot tr').insertBefore($('#example thead tr'))
    }

but it is not working

I have tried on https://jsfiddle.net/bigwelly/xpndms1a/8/

Answers

This discussion has been closed.