<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
    <link href="https://nightly.datatables.net/searchpanes/css/searchPanes.dataTables.min.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/searchpanes/js/dataTables.searchPanes.min.js"></script>
    <link href="https://nightly.datatables.net/select/css/select.dataTables.min.css" rel="stylesheet" type="text/css" />
    <script src="https://nightly.datatables.net/select/js/dataTables.select.min.js"></script>
    
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
  </head>
  <body>
    <div class="container">
      <table id="example" class="display nowrap" width="100%">
        <thead>
          <tr>
            <th>Name</th>
            <th>Position</th>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <th>Name</th>
            <th>Position</th>
          </tr>
        </tfoot>
        <tbody>
          <tr>
            <td>Tiger Car Nixon</td>
            <td>System Architect</td>
          </tr>
          <tr>
            <td>Garrett House Winters</td>
            <td>Director</td>
          </tr>
          <tr>
            <td>Ashton Sea Cox</td>
            <td>Technical Author</td>
          </tr>
          <tr>
            <td>Cedric Sea Kelly</td>
            <td>Javascript Developer</td>
          </tr>
          <tr>
            <td>Jenna Car Elliott</td>
            <td>Financial Controller</td>
          </tr>
         
        </tbody>
      </table>
    </div>
  </body>
</html>
 
body {
  font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}
 
$(document).ready( function () {
function buildCustomSearchPane() {
    let searchArr = ['Car', 'House', 'Sea'];
    let options = []
    searchArr.forEach(function (singleString) {
        options.push({
            label: singleString,
            value: function (rowData, rowIdx) {
                var re = new RegExp(singleString, "i");
                return rowData[0].match(re);
            },
        });
    });
    return options
}
  
  
  
  var table = $('#example').DataTable({
    dom: 'Plfrtip',  
    columnDefs:[
        {
            searchPanes:{
              show: true,
              options: buildCustomSearchPane()
            },
            targets: [0]
        },
    ]
 });
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers