Remove the dropdowns on all columns

Remove the dropdowns on all columns

Heart94Heart94 Posts: 2Questions: 1Answers: 1

Hi,

https://www.sol1d.team/k4/index.php

Is it possible to remove the dropdowns menu from all the columns ?

I've tried:

$('#myTable').DataTable({
"myTable.columns":false,
dom: 'Qifrtpl',
orderCellsTop: true,
fixedHeader: true,

But even putting "myTable.columns":false, the dropdown menus still appears.

Thank you,

Heart

This question has an accepted answers - jump to answer

Answers

  • Heart94Heart94 Posts: 2Questions: 1Answers: 1
    Answer ✓

    I figured it out by myself by removing this from my code:

      initComplete: function() {
                    this.api().columns().every(function() {
                        var column = this;
                        var select = $('<select><option value=""><i>Select...</i></option></select>')
                            .appendTo($(column.header()).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>');
                        });
                    });
                },
    

    thank you :D

  • allanallan Posts: 63,441Questions: 1Answers: 10,459 Site admin

    Thanks for the update - good to hear you got it working as you need.

    Allan

Sign In or Register to comment.