<html>
<head>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link href="https://nightly.datatables.net/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script src="https://nightly.datatables.net/js/jquery.dataTables.js"></script>
<meta charset=utf-8 />
<title>DataTables - JS Bin</title>
</head>
<body>
<div class="container">
<table id="example" class="display nowrap" width="100%">
<table id="transactions-table" class="table table-hover table-in-card card-data-table">
<thead>
<tr>
<th scope="col">Categoría</th>
<th scope="col">Comentarios</th>
<th scope="col" >Fecha de creación</th>
<th scope="col">Creado por</th>
<th scope="col" >Fecha de modificación</th>
<th scope="col">Modificado por</th>
<th scope="col">Acciones</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 table = $("#transactions-table").DataTable({
ajax: {
type: "POST",
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
},
url: source,//Laravel route that returns a json with all table content,
data: {
policy_id: "{{ $view_data['policy_model']->id }}"
}
},
destroy: true,
orderCellsTop: true,
fixedHeader: true,
scrollX: true,
scrollCollapse: true,
"columnDefs":[
{
"width": "5%",
"orderable": true,
"targets": [-1]
},
{
"width": "auto",
"targets": '_all'
}
],
fixedColumns: {
leftColumns: 0,
rightColumns: 1,
},
dom: 'Bfrtlip',
select: {
selector: 'td:not(:last-child)',
},
language: {
url: '//cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json',
buttons:{
'export': 'Exportar',
'clearAll': 'Limpiar selección',
'selectAll': 'Seleccionar todos',
'bulkActions': 'Acciones en lote',
},
select:{
rows: {
_: '%d registros seleccionados',
0: 'Haga clic en un registro para seleccionarlo',
1: '1 registro seleccionado',
}
}
},
lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],
searching: true,
order: [],
rowsGroup: ($('#'+table_id+'.card-data-table').data('rowgroup') >= 0 ) ? [$('#'+table_id+'.card-data-table').data('rowgroup'), 0] : '',
buttons:[],
drawCallback: function( settings ){
$('[data-toggle="tooltip"]').tooltip({
container: 'body'
});
$('a[data-toggle="tab"].has-table').each(function(){
var target = $(this).attr('href');
text = $(target+'.show').find('.text-cut');
text.each(function(){
var item = $(this);
str = item.text().substr(0, 75);
count = item.text().length;
dots = (count > 75) ? ' ...' : '';
item.text(str+dots);
});
});
},
initComplete: function(){
var dtSelectAll = $('.dt-select-all');
dtSelectAll.html('<i class="fas fa-check-square" data-toggle="tooltip" title="Seleccionar Todos"></i>');
var dtSelectNone = $('.dt-select-none');
dtSelectNone.html('<i class="fas fa-eraser" data-toggle="tooltip" title="Limpiar Selección"></i>');
var dtExport = $('.dt-export');
dtExport.html('<i class="fas fa-file-export" data-toggle="tooltip" title="Exportar"></i>');
var dtBulkActions = '<div class="dropdown" data-toggle="tooltip" title="Acciones en Lote">'
+'<button id="dropdown-actions" class="dt-button dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">'
+'<i class="fas fa-layer-group"></i>'
+'</button>'
+'<div class="dropdown-menu" aria-labelledby="dropdown-actions">'
+'<a class="dropdown-item" href="#">Eliminar</a>'
+'<a class="dropdown-item" href="#">Editar</a>'
+'</div>'
+'</div>';
$('.spur-card-action .buttons button:first-child').before($(dtBulkActions));
$('.dataTables_length, .dataTables_info, .dataTables_paginate').wrapAll('<div class="dt-footer-wrapper d-flex align-items-center"></div>');
}
});
} );
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. |