Jquery – How to disable filtering on one column and keep it for other columns in a jQuery Datatable

datatablesfilterjquery

I am new to jQuery and I need to know if there's any way to disable filtering for one of the columns in my jQuery datatable?
My datatable has 5 columns and I need to disable filtering for the last column.

Best Answer

Use the bSearchable flag. From the docs:

// Using aoColumnDefs
$(document).ready( function() {
  $('#example').dataTable( {
    "aoColumnDefs": [
      { "bSearchable": false, "aTargets": [ 0 ] }
    ] } );
} );


// Using aoColumns
$(document).ready( function() {
  $('#example').dataTable( {
    "aoColumns": [
      { "bSearchable": false },
      null,
      null,
      null,
      null
    ] } );
} );