When data source is Ajax, Individual column searching (select inputs) is not displayed

When data source is Ajax, Individual column searching (select inputs) is not displayed

MaxZMaxZ Posts: 1Questions: 1Answers: 0

When data source is Ajax, Individual column searching (select inputs) is not displayed:

<script type="text/javascript" class="init">
        $(document).ready(function() {
                $('#example').DataTable( {
                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>' )
                        } );
                    } );
                },
            
                "ajax": 'http://someurl.com/data.txt',
                    
                
                columns: [
                    { title: "Name" },
                    { title: "Position" },
                    { title: "Office" },
                    { title: "Extn." },
                    { title: "Start date" },
                    { title: "Salary" }
                ],

            
                "dom": "<'row'<'col-sm-12 data-filter btn-sm text-right'B>>" +  "<'row'<'col-sm-6'l><'col-sm-6'f>>" +
                       "<'row'<'col-sm-12'tr>>" +
                       "<'row'<'col-sm-5'i><'col-sm-7'p>>",
                buttons: [
                'excel', 'print'
                ],
                stateSave: true,
                "lengthMenu": [15, 25, 50, 100, 150],
                
                
            } );
            
        } );
    
    
    </script>

What can be the problem? Thank you.

This discussion has been closed.