-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcod.js
73 lines (65 loc) · 2.49 KB
/
cod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
$(document).ready(function() {
let table = new DataTable('#tabla', {
dom: 'Blfrtip',
buttons: [
{
extend: 'copy',
text: 'Copiar',
// className: ''
},
{
extend: 'csv',
text: 'Exportar a CSV',
},
{
extend: 'excel',
text: 'Exportar a Excel',
},
{
extend: 'pdf',
text: 'Exportar a PDF',
title: 'List of users, date: ' + new Date().toLocaleString(),
filename: 'Listado de empleados',
customize: function(doc) {
doc.content.splice(0, 0, {
text: 'Lista de Empleados',
style: 'header'
});
doc.content.splice(1, 0, {
text: 'Este es un mensaje adicional para el PDF.',
margin: [0, 0, 0, 20]
});
}
},
{
extend: 'print',
text: 'Imprimir',
title: 'List of users'
}
],
language: {
url: 'https://cdn.datatables.net/plug-ins/2.1.7/i18n/es-AR.json',
},
lengthMenu: [5, 10, 25, 50, 75, 100, 200, 300, 500, 1000],
pageLength: 5,
});
// Espera un poco para asegurarte de que los botones están en el DOM
setTimeout(function() {
$('.dt-button.buttons-copy.buttons-html5')
.removeClass('dt-button')
.addClass('bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded');
// Repite para otros botones si es necesario
$('.dt-button.buttons-csv.buttons-html5')
.removeClass('dt-button')
.addClass('bg-green-500 hover:bg-green-700 text-white font-bold py-2 px-4 rounded');
$('.dt-button.buttons-excel.buttons-html5')
.removeClass('dt-button')
.addClass('bg-yellow-500 hover:bg-yellow-700 text-white font-bold py-2 px-4 rounded');
$('.dt-button.buttons-pdf.buttons-html5')
.removeClass('dt-button')
.addClass('bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded');
$('.dt-button.buttons-print')
.removeClass('dt-button')
.addClass('bg-indigo-500 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded');
}, 100); // 100 ms de espera
});