I'm using the following code to add filtering on one column in my datatable:

"initComplete": function () {
                this.api().column(4).every( function () {
                    var column = this;
                    var select = jQuery('<select><option value=""></option></select>')
                    .appendTo( jQuery(column.header()).empty() )
                    .on( 'change', function () {
                        var val = jQuery.fn.dataTable.util.escapeRegex(

                            .search( val ? '^'+val+'$' : '', true, false )

                    column.data().unique().sort().each( function ( d, j ) {
                        select.append( '<option value="'+d+'">'+d+'</option>' )

I was wondering 1) if there is a way to add an 'All' option to the filter rather than just the blank filter selection option and 2) if there is a way to add a label to the left of the filter dropdown, e.g., Type?



Found answer to part 1 - replace the "" with "All":

<select><option value="All"></option></select>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.