<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <link rel="stylesheet" type="text/css"
    href="https://cdn.datatables.net/v/dt/dt-1.10.25/cr-1.5.4/rr-1.2.8/sp-1.3.0/sl-1.3.3/datatables.min.css" />
    
  <script type="text/javascript"
    src="https://cdn.datatables.net/v/dt/dt-1.10.25/cr-1.5.4/rr-1.2.8/sp-1.3.0/sl-1.3.3/datatables.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>
        <tbody>
        </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 () {
  var tableData = [];
    tableData.push(['Person 1', 'Active']);
  tableData.push(['Person 2', 'Inactive']);
  tableData.push(['Person 3', 'Active']);
  var table = $('#example').DataTable({
    data: tableData,
      dom: 'frtipP',
      columns: [
        { width: '80%' },
        { width: '20%' }],
    columnDefs: [{
        searchPanes: {
          preSelect: ['Active'],
          show: true
        },
        targets: [1]
      }]
  });
  
} );
Output 300px

This bin was created anonymously and its free preview time has expired. Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers