How can I search in a specific column using the jQuery DataTables plugin?

arrays, datatables, jquery, jquery-plugins

Solution

You can use `column().search()` to obtain search on specific value, ex:

  var table = $('#example-table').DataTable();

  $('#search-input').on('change', function(){

    table
    .column(4)
    .search(this.value)
    .draw();

  });

Working Demo

Refrences

Problem

I used the `jquery dataTable plugin` to show a table which contains (username, dates, and email). I want to disable the filtering/search for the username and email columns and enable just the search for the dates. when I click on the search field I'll open a calendar to choose the date which we will look for. I just want to use this plugin for filtering only dates, basically. Can this be done? -edit-- I read the docs :dateRange But It doesn't work for me I added the ``` ('.dataTable').dataTable() .columnFilter({ sPlaceHolder: "head:before", aoColumns: [null, { type: "date-range" }, null] }); ``` And I duplicated the headers but I can't get the date fields or any other field to search the data into.

Original source