<html>
<head>
<!-- jQuery 3.6.0 -->
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<!-- Bootstrap4 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<!-- DataTables 1.12.1 -->
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>
<!-- DataTables Bootstrap4 1.12.1 -->
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap4.min.js"></script>
<link href="https://cdn.datatables.net/1.12.1/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- SearchPanes nightly! -->
<script src="https://nightly.datatables.net/searchpanes/js/dataTables.searchPanes.js"></script>
<!-- works fine with SearchPanes 2.0.2 -->
<!--
<script src="https://cdn.datatables.net/searchpanes/2.0.2/js/dataTables.searchPanes.min.js"></script>
-->
<!-- SearchPanes Bootstrap4 2.0.2 -->
<script src="https://cdn.datatables.net/searchpanes/2.0.2/js/searchPanes.bootstrap4.min.js"></script>
<link href="https://cdn.datatables.net/searchpanes/2.0.2/css/searchPanes.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- Buttons 2.2.3 -->
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<!-- Buttons Bootstrap4 2.2.3 -->
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.bootstrap4.min.js"></script>
<link href="https://cdn.datatables.net/buttons/2.2.3/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<!-- Select 1.4.0 -->
<script src="https://cdn.datatables.net/select/1.4.0/js/dataTables.select.min.js"></script>
<!-- Select Bootstrap4 1.4.0 -->
<link href="https://cdn.datatables.net/select/1.4.0/css/select.bootstrap4.min.css" rel="stylesheet" type="text/css" />
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<table id="debug" width="100%">
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
</thead>
</table>
</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 tableElement = jQuery('table#debug');
tableElement.DataTable({
dom: 'B<".searchPanes collapse mb-3 mt-3"><"d-flex flex-row justify-content-between align-items-start mb-3"<"flex-fill"i><"flex-fill"f>>t<"d-flex flex-row justify-content-between align-items-start mt-3"<"flex-fill"l><"flex-fill"p>>r',
ajax: 'http://datatables.showroom.efficient.it/data/?simple',
buttons: [
{
extend: 'searchPanes',
config: {
layout: 'columns-4',
initCollapsed: true,
cascadePanes: true,
viewTotal: true
},
action: function() {
var DataTableApi = tableElement.dataTable().api();
jQuery(DataTableApi.table().container()).children('div.searchPanes').collapse('toggle');
}
}
],
columns: [
{
data: 'first_name',
name: 'first_name',
searchPanes: {
show: true
}
},
{
data: 'last_name',
name: 'last_name',
searchPanes: {
show: true
}
},
{
data: 'email',
name: 'email',
searchPanes: {
show: true
}
}
],
language: {
searchPanes: {
collapse: {
0: 'Filter (%d)',
_: 'Filter (%d)'
}
}
}
});
tableElement.on('init.dt', function(event) {
var DataTableApi = tableElement.dataTable().api();
var SearchPanesContainer = jQuery(DataTableApi.table().container()).children('div.searchPanes');
SearchPanesContainer.append(jQuery('<div class="card card-body pt-5">').append(jQuery('<button class="close position-absolute" style="right:10px;top:5px;"><span>×</span></button>').on('click', function(event) {
SearchPanesContainer.collapse('hide');
event.preventDefault();
})));
new jQuery.fn.dataTable.SearchPanes(DataTableApi, {
// config added
layout: 'columns-4',
initCollapsed: true,
cascadePanes: true,
viewTotal: true
});
DataTableApi.searchPanes.container().appendTo(SearchPanesContainer.find('div.card'));
DataTableApi.searchPanes.resizePanes();
});
});
You can jump to the latest bin by adding /latest
to your URL
Shortcut | 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. |