<!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>
    <meta charset=utf-8 />
    <title>DataTables - JS Bin</title>
  </head>
  <body>
    <div class="container">
      <table id="myTable" class="table table-striped table-bordered dt-responsive nowrap" style="width: 100%">
      <thead>
                                        <tr>
                                            <th data-toggle="tooltip" data-placement="top" data-state="primary" title="" data-original-title="Click on alert number to view and manage">Alert</th>
                                            <th data-toggle="tooltip" data-placement="top" data-state="primary" title="" data-original-title="Indicates the type of alert the sensor is sending">Type</th>
                                            <th data-toggle="tooltip" data-placement="top" data-state="primary" title="" data-original-title="Alert message being sent by the sensor">Message</th>
                                            <th data-toggle="tooltip" data-placement="top" data-state="primary" title="" data-original-title="Date the sensor sent the alert">Date Raised</th>
                                            <th data-toggle="tooltip" data-placement="top" data-state="primary" title="" data-original-title="Highlights which alerts have been actioned or require attention">Status</th>
                                            <th></th>
                                        </tr>
                                    </thead>
      </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 () {
$('#myTable thead tr').clone(true).appendTo('#myTable thead');
      
        $('#myTable').DataTable({
         
            initComplete: function () {
                this.api().columns([1, 2]).every(function () {
                    var column = this;
                    var select = $('<select><option value=""></option></select>')
                        .appendTo($('#myTable thead tr:eq(1) th').eq(column.index()).empty())
                        .on('change', function () {
                            var val = $.fn.dataTable.util.escapeRegex(
                                $(this).val()
                            );
                            column
                                .search($(this).val())
                                .draw();
                        });
                    column.data().unique().sort().each(function (d, j) {
                        select.append('<option value="' + d + '">' + d + '</option>')
                    });
                });
            },
            
             processing: true,
            serverSide: true,
            
            fixedHeader:true,
            orderCellsTop: true,
            ordering: true,
            paging: true,
            responsive: true,
            ajax: "/ssp/objects.php",
            type: 'POST',
        columns: [
            { "data": "first_name" },
            { "data": "last_name" },
            { "data": "position" },
            { "data": "office" },
            { "data": "start_date" },
            { "data": "salary" }
        ]
        });
      
    });
1 error
Line 23: Missing semicolon.
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers