465
| <![CDATA[<script>
$(document).ready(function () {
let dt = $('#datatable').DataTable({
"processing": true,
"stateSave": true,
"serverSide": true,
"scrollX": true,
"language": {"url": 'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Portuguese-Brasil.json'},
"ajax": {
url: "https://sje.mg.gov.br/covid/get",
dataSrc: function ( data ) {
last_update = data.last_update;
return data.data;
}
},
"columns": [
{"data": "contratado"},
{"data": "valor"},
{"data": "descricao"},
{"data": "data_inicio"},
{"data": "action", name: "action", orderable: false, searchable: false, class: "text-center"},
],
"footerCallback": function ( row, data, start, end, display ) {
let api = this.api()
$(api.column(2).footer()).html(
`Última atualização: ${last_update}`
);
},
"dom": 'Bfrtip',
"buttons": [
{
extend:'excelHtml5',
text: 'Excel',
action: function ( e, dt, node, config ) {
let url ='https://sje.mg.gov.br/covid/export?format=xlsx'
window.open(url);
}
},
{
extend:'excelHtml5',
text: 'ODS',
action: function ( e, dt, node, config ) {
let url ='https://sje.mg.gov.br/covid/export?format=ods'
window.open(url);
}
},
{
extend: 'csvHtml5',
action: function ( e, dt, node, config ) {
let url ='https://sje.mg.gov.br/covid/export?format=csv'
window.open(url);
}
},
]
});
});
</script>]]>
|