<!DOCTYPE html>
<html>
  <head>
    <script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<link href="https://cdn.datatables.net/v/dt/dt-2.2.2/sl-3.0.0/datatables.min.css" rel="stylesheet" integrity="sha384-EmS4/qRpIMM3zb0MjRhpA0VZ2FCMIqgTf51cGC7J0N+g2Y4rjNUDhaUws0qgjonz" crossorigin="anonymous">
 
<script src="https://cdn.datatables.net/v/dt/dt-2.2.2/sl-3.0.0/datatables.min.js" integrity="sha384-ofM3l4l/uWFr51fWnSBVR+e7gMk9uyYRWJf91ExxpCwteUbRIpzNRraD08LD6dJr" crossorigin="anonymous"></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></th>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
          </tr>
        </thead>
        <tfoot>
          <tr>
            <th></th>
            <th>Name</th>
            <th>Position</th>
            <th>Office</th>
            <th>Age</th>
            <th>Start date</th>
            <th>Salary</th>
          </tr>
        </tfoot>
      </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;
}
 
function dtTblPackage( data ) {
  return $('#example').DataTable({
    destroy: true,
    data: data,
    processing: true,
  columns: [
      {
        orderable: false,
        render: DataTable.render.select(),
        targets: 0
      },
    { data: 'name' },
    { data: 'position' },
    { data: 'office' },
    { data: 'extn' },
    { data: 'start_date' },
    { data: 'salary' },
  ],
    select: {
      style: 'os',
      selector: 'td:first-child'
    },
    order: [[1, 'asc']]
  });
}
let fakeData = [];
let table = dtTblPackage( fakeData );
table.processing(true);
    $.ajax({
      url: "/ajax/objects.txt",
      success: function (data) {
        data = JSON.parse(data);
        let table = dtTblPackage( data.data );
        table.processing(false);
      }
    });
3 warnings
Line 28: 'let' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Line 29: 'let' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Line 37: 'let' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers