<html>
<head>
<link
rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.datatables.net/v/bs4/jq-3.3.1/dt-1.10.24/sl-1.3.3/datatables.min.css"
/>
<script
type="text/javascript"
src="https://cdn.datatables.net/v/bs4/jq-3.3.1/dt-1.10.24/sl-1.3.3/datatables.min.js"
></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<div class="container">
<table
id="my-table"
class="table table-striped table-hover mt-5"
style="width: 100%;"
>
<thead>
<tr>
<th></th>
<th>ID</th>
<th>Source</th>
<th>Target</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 () {
var data = {
"data": [
{
"segment_id": 944,
"id": 1,
"source": "This news is about Star Wars.",
"target": "",
"status": 0
},
{
"segment_id": 34,
"id": 2,
"source": "Are you a fan?",
"target": "",
"status": 0
},
{
"segment_id": 35,
"id": 3,
"source": "People make a big Star Wars model.",
"target": "",
"status": 1
},
{
"segment_id": 36,
"id": 4,
"source": "You can see it in England.",
"target": "",
"status": 0
},
{
"segment_id": 37,
"id": 5,
"source": "The model is made from Legos.",
"target": "",
"status": 0
}
]
};
const datatableOptions = {
scrollY: "400px",
scrollCollapse: true,
paging: false,
select: {
style: "multi",
selector: "td:first-child"
}
};
var table = $("#my-table").DataTable({
//ajax: 'https://vvr2h.csb.app/public/myjson.json',
data: data.data,
order: [[1, 'asc']],
columns: [
{ data: null, defaultContent: "" },
{ data: "id" },
{ data: "source" },
{ data: "target" }
],
columnDefs: [
{
className: "select-checkbox align-middle",
targets: 0,
orderable: false
},
{
targets: 1,
className: "align-middle"
},
{
targets: 2,
className: "align-middle",
orderable: false
},
{
targets: 3,
className: "align-middle",
orderable: false
}
],
datatableOptions
});
} );
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. |