<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-3.7.0.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/2.4.2/js/dataTables.buttons.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.html5.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/buttons/2.4.2/js/buttons.print.min.js"></script>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/select/1.7.0/js/dataTables.select.min.js"></script>
</head>
<body>
<div class = wrapper>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th></th>
<th>Last Name(s)</th>
<th>First Name(s)</th>
<th>Title</th>
<th>Media</th>
<th>Year</th>
<th>Tags</th>
</tr>
</thead>
<!-- <tfoot>
<tr>
<th></th>
<th>Last Name</th>
<th>First Name</th>
<th>Title</th>
<th>Media</th>
<th>Year</th>
<th>Tags</th>
</tr>
</tr>
</tfoot> -->
</table>
</div>
<script type="text/javascript" language="javascript" src="scripts/get_data.js"></script>
</body>
</html>
@font-face {
font-family: 'concourse';
src: url('../fonts/concourse/concourse_2_regular.woff2') format('woff2');
}
body {
font-family: concourse, Helvetica, sans-serif;
height: 100vh;
}
table#example.dataTable tbody tr:hover {
background: #BBE5E5;
}
table#example.dataTable tbody tr:hover > .sorting_1 {
background: #BBE5E5;
}
:root {
-row-selected: 112,132,132;
}
.wrapper{
height: 100vh;
}
.controls{
display: flex;
height: 3em;
align-content: center;
padding: 1em;
border: 1px solid red;
}
.search{
padding-right: 1em;
border: 1px solid blue;
}
.export{
display: flex;
align-content: center;
border: 2px dashed red;
}
.selection{
border: 2px solid blue;
}
.buttons{
border: 2px solid green;
}
function get_data() {
// Formatting function for row details.
// d = original data object for the row
function format(d) {
let info = '';
if(d.Notes){
info += '<dt>Notes:</dt>' + d.Notes;
} else{
info += '<dt>Notes:</dt>' + 'N/A';
}
if(d.Description){
info += '<dt>Description:</dt>' + d.Description
} else{
info += '<dt>Description:</dt>' + 'N/A';
}
if(d.Hyperlink){
info += '<dt>Hyperlink:</dt>' + '<a href="' + d.Hyperlink + '" target="_blank">' + d.Hyperlink + '</a>';
} else{
info += '<dt>Hyperlink:</dt>' + 'N/A';
}
if(d.Contributor){
info += '<dt>Contributor:</dt>' + d.Contributor
} else{
info += '<dt>Contributor:</dt>' + 'N/A';
}
return(info);
} // format
let table = new DataTable('#example', {
ajax: 'ajax/data/pg_resources_all_standard.json',
dom: '<"controls"<"search"f><"export"<"selection"><"buttons"B>>>t',
fnInitComplete: function(){
$('div.selection').html('<p>Selection:</p>');
},
paging: false,
scrollCollapse: true,
scrollY: '100vh',
buttons: [
'copy',
'pdf',
],
select: true,
columns: [
{
className: 'dt-control',
orderable: false,
data: null,
defaultContent: ''
},
{ data: 'Last Name' },
{ data: 'First name' },
{ data: 'Title' },
{ data: 'Media' },
{ data: 'Year' },
{ data: 'Tags' },
],
order: [[1, 'asc']]
});
// Add event listener for opening and closing details
table.on('click', 'td.dt-control', function (e) {
let tr = e.target.closest('tr');
let row = table.row(tr);
if (row.child.isShown()) {
// This row is already open - close it
row.child.hide();
}
else {
// Open this row
row.child(format(row.data())).show();
}
});
}
// document.querySelector('div.buttons_text').innerHTML = '<p>selection -></p>';
get_data();
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. |