Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

806
Views
How to redraw Datatable columns filter?

I am using datatable plugin with individual column filters, I found this is a great plugin but it's only filtering table data not the values in columns filter dropdown after selection of the column filter.

Here I am looking, when I select one column filter then it will also redraw other column filters instead of showing all the values in that column of entire table.

I am looking like in this example

datatable

If I selected Singapore from Office column filter it's showing 4 records with 4 different positions, I am expecting only those 4 values in Position column filter. But it's giving all unique values of entire table.

Can someone help me how can i achieve this?

I have my code something as below:

$('#myTableId').DataTable( {
                colReorder : true,
                initComplete: function () {
                    this.api().columns([0,1]).every( function () {
                        var column = this;
                        var select = $('<select><option value="">All</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>' )
                        } );
                    } );
                }
            } );  
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!