<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.3.js"></script>
<link href="https://cdn.datatables.net/2.2.2/css/dataTables.dataTables.css" rel="stylesheet" integrity="sha384-ZVBvXH2IGOw6fHIntvmU2wOUGWutDViMwSQwdGEvaJkHVvm1S8N/HE/zBK91NXSV" crossorigin="anonymous">
<link href="https://cdn.datatables.net/buttons/3.2.2/css/buttons.dataTables.css" rel="stylesheet" integrity="sha384-WnU9UKIFykmC5nUngG4IGkdl3+/E5Rx7JmiggfjyAY804EuDkGcxL4aJMdN5iuTJ" crossorigin="anonymous">
<link href="https://cdn.datatables.net/select/3.0.0/css/select.dataTables.css" rel="stylesheet" integrity="sha384-BFcTahKzxalLFZINPV5uMsgsaxUMxCdXeTdkMal/2rM0rl+xZGVSniOXU8CxjSZ1" crossorigin="anonymous">
<script src="https://cdn.datatables.net/2.2.2/js/dataTables.js" integrity="sha384-gGekiWQ/bm8p71RTsvhPShoIBxcf8BsVjRTi0WY8FvxuQa2nKS0PKHiSXV9nfW/A" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/buttons/3.2.2/js/dataTables.buttons.js" integrity="sha384-wCLG3FbyFPnMZM65D+pam9KW+2joK88dh4jfSMK0OuMQ2cBQHV0t55OqmQduaQ1S" crossorigin="anonymous"></script>
<script src="https://cdn.datatables.net/select/3.0.0/js/dataTables.select.js" integrity="sha384-hJjpz/IhFX8FAfkNB7zZrVouwlDrs/fzYxtAlUH5Ks1daudIQpG5hRjFp4xIphDb" crossorigin="anonymous"></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<div class="container">
<table id="example" class="display" width="100%">
<thead>
<tr>
<th></th>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th>First name</th>
<th>Last name</th>
<th>Position</th>
<th>Office</th>
</tr>
</tfoot>
</table>
</div>
</body>
</html>
DataTable.Api.register( 'select.deselectAll()', function ( klass ) {
return this.iterator( 'table', function ( ctx, index ) {
var dt = new DataTable.Api(ctx);
ctx._select_set = [];
dt.draw('page');
} );
} );
var table = new DataTable('#example', {
processing: true,
serverSide: true,
ajax: {
url: '/ssp/objects.php',
type: 'post'
},
columns: [
{data: null, orderable: false, searchable: false, render: DataTable.render.select()},
{data: 'first_name'},
{data: 'last_name'},
{data: 'position'},
{data: 'office'}
],
order: [[1, 'asc']],
select: true,
layout: {
topStart: {
buttons: [
'pageLength',
{
text: 'Deselect All',
action: function (e, dt) {
// Call the custom API
dt.select.deselectAll();
console.log(dt.select.cumulative().rows)
}
}
]
}
},
});
This bin was created anonymously and its free preview time has expired. Get a free unrestricted account
Dismiss xShortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + [ | Indents selected lines |
ctrl + ] | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Clone Bin |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |